Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
- Loading branch information
1 parent
c1351c9
commit 6193a84
Showing
39 changed files
with
1,026 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@vue-macros/short-bind': minor | ||
'@vue-macros/volar': minor | ||
'@vue-macros/eslint-config': minor | ||
'unplugin-vue-macros': minor | ||
'@vue-macros/nuxt': minor | ||
--- | ||
|
||
Introduce `shortBind` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# shortBind | ||
|
||
<StabilityLevel level="experimental" /> | ||
|
||
A shorthand for binding prop with the same data name. | ||
|
||
`:value` -> `:value="value"` | ||
|
||
If you have any questions about this feature, you can comment on [RFC Discussion](https://github.com/vuejs/rfcs/discussions/405). | ||
|
||
| Features | Supported | | ||
| :----------: | :----------------: | | ||
| Vue 3 | :white_check_mark: | | ||
| Nuxt 3 | :white_check_mark: | | ||
| Vue 2 | :x: | | ||
| Volar Plugin | :white_check_mark: | | ||
|
||
## Usage | ||
|
||
### Basic Usage | ||
|
||
```vue | ||
<template> | ||
<input :msg /> | ||
<!-- => <input :msg="msg" /> --> | ||
<demo $msg /> | ||
<!-- => <input $msg="msg" /> --> | ||
</template> | ||
``` | ||
|
||
### With `shortVmodel` | ||
|
||
```vue | ||
<template> | ||
<input ::msg /> | ||
<!-- => <input ::msg="msg" /> => <input v-model:msg="msg" /> --> | ||
<demo $msg /> | ||
<!-- => <input $msg="msg" /> => <input v-model:msg="msg" /> --> | ||
<demo *msg /> | ||
<!-- => <input *msg="msg" /> => <input v-model:msg="msg" /> --> | ||
</template> | ||
``` | ||
|
||
## Volar Configuration | ||
|
||
```jsonc {5} | ||
// tsconfig.json | ||
{ | ||
"vueCompilerOptions": { | ||
"plugins": [ | ||
"@vue-macros/volar/short-bind" | ||
// ... | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## ESLint Configuration | ||
|
||
```jsonc {4} | ||
// .eslintrc | ||
{ | ||
"rules": { | ||
"vue/valid-v-bind": "off" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# shortBind | ||
|
||
<StabilityLevel level="experimental" /> | ||
|
||
绑定相同数据名称的 `prop` 的语法糖。 | ||
|
||
`:value` -> `:value="value"` | ||
|
||
如果你对此功能有任何疑问,欢迎在 [RFC](https://github.com/vuejs/rfcs/discussions/405) 中发表评论。 | ||
|
||
| Features | Supported | | ||
| :----------: | :----------------: | | ||
| Vue 3 | :white_check_mark: | | ||
| Nuxt 3 | :white_check_mark: | | ||
| Vue 2 | :x: | | ||
| Volar Plugin | :white_check_mark: | | ||
|
||
## 用法 | ||
|
||
### 基本用法 | ||
|
||
```vue | ||
<template> | ||
<input :msg /> | ||
<!-- => <input :msg="msg" /> --> | ||
<demo $msg /> | ||
<!-- => <input $msg="msg" /> --> | ||
</template> | ||
``` | ||
|
||
### 和 `shortVmodel` 一起使用 | ||
|
||
```vue | ||
<template> | ||
<input ::msg /> | ||
<!-- => <input ::msg="msg" /> => <input v-model:msg="msg" /> --> | ||
<demo $msg /> | ||
<!-- => <input $msg="msg" /> => <input v-model:msg="msg" /> --> | ||
<demo *msg /> | ||
<!-- => <input *msg="msg" /> => <input v-model:msg="msg" /> --> | ||
</template> | ||
``` | ||
|
||
## Volar 配置 | ||
|
||
```jsonc {5} | ||
// tsconfig.json | ||
{ | ||
"vueCompilerOptions": { | ||
"plugins": [ | ||
"@vue-macros/volar/short-bind" | ||
// ... | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## ESLint 配置 | ||
|
||
```jsonc {4} | ||
// .eslintrc | ||
{ | ||
"rules": { | ||
"vue/valid-v-bind": "off" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @vue-macros/short-bind [![npm](https://img.shields.io/npm/v/@vue-macros/short-bind.svg)](https://npmjs.com/package/@vue-macros/short-bind) | ||
|
||
Please refer to [README.md](https://github.com/vue-macros/vue-macros#readme) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"name": "@vue-macros/short-bind", | ||
"version": "0.0.0", | ||
"packageManager": "pnpm@8.7.6", | ||
"description": "short-bind feature from Vue Macros.", | ||
"keywords": [ | ||
"vue-macros", | ||
"macros", | ||
"vue", | ||
"sfc", | ||
"setup", | ||
"script-setup", | ||
"short-bind" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/vue-macros/vue-macros#readme", | ||
"bugs": { | ||
"url": "https://github.com/vue-macros/vue-macros/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vue-macros/vue-macros.git", | ||
"directory": "packages/short-bind" | ||
}, | ||
"author": "三咲智子 <sxzz@sxzz.moe>", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"dev": "./src/index.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
}, | ||
"./api": { | ||
"dev": "./src/api.ts", | ||
"require": "./dist/api.js", | ||
"import": "./dist/api.mjs" | ||
}, | ||
"./rollup": { | ||
"dev": "./src/rollup.ts", | ||
"require": "./dist/rollup.js", | ||
"import": "./dist/rollup.mjs" | ||
}, | ||
"./vite": { | ||
"dev": "./src/vite.ts", | ||
"require": "./dist/vite.js", | ||
"import": "./dist/vite.mjs" | ||
}, | ||
"./*": [ | ||
"./*", | ||
"./*.d.ts" | ||
] | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"./dist/*", | ||
"./*" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "DEV=true tsup" | ||
}, | ||
"dependencies": { | ||
"@vue-macros/common": "workspace:*", | ||
"@vue/compiler-core": "^3.3.4" | ||
}, | ||
"devDependencies": { | ||
"@vue/compiler-sfc": "^3.3.4", | ||
"rollup": "^3.29.2" | ||
}, | ||
"engines": { | ||
"node": ">=16.14.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './transformer' |
Oops, something went wrong.