File tree Expand file tree Collapse file tree 2 files changed +40
-10
lines changed
packages/babel-plugin-jsx Expand file tree Collapse file tree 2 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ const App = () => <input type="email" placeholder={placeholderText} />;
134134
135135### 指令
136136
137- v-show
137+ #### v-show
138138
139139```jsx
140140const App = {
@@ -147,14 +147,18 @@ const App = {
147147};
148148```
149149
150- v-model
150+ #### v-model
151151
152152> 注意:如果想要使用 `arg`, 第二个参数需要为字符串
153153
154154```jsx
155155<input v-model={val} />
156156```
157157
158+ ```jsx
159+ <input v-model:argument={val} />
160+ ```
161+
158162```jsx
159163<input v-model={[val, ["modifier"]]} />
160164```
@@ -175,7 +179,7 @@ h(A, {
175179});
176180```
177181
178- v-models
182+ #### v-models (从 1.1.0 开始不推荐使用)
179183
180184> 注意: 你应该传递一个二维数组给 v-models。
181185
@@ -220,6 +224,17 @@ h(A, {
220224
221225自定义指令
222226
227+ 只有 argument 的时候推荐使用
228+
229+ ```jsx
230+ const App = {
231+ directives: { custom: customDirective },
232+ setup() {
233+ return () => <a v-custom:arg={val} />;
234+ },
235+ };
236+ ```
237+
223238```jsx
224239const App = {
225240 directives: { custom: customDirective },
@@ -284,7 +299,7 @@ const App = {
284299};
285300```
286301
287- ### 在 TypeSript 中使用
302+ ### 在 TypeScript 中使用
288303
289304`tsconfig.json`:
290305
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ Install the plugin with:
1414npm install @vue/babel-plugin-jsx -D
1515```
1616
17- Then add the plugin to .babelrc :
17+ Then add the plugin to your babel config :
1818
19- ``` js
19+ ``` json
2020{
2121 "plugins" : [" @vue/babel-plugin-jsx" ]
2222}
@@ -138,7 +138,7 @@ const App = () => <input type="email" placeholder={placeholderText} />;
138138
139139### Directives
140140
141- v-show
141+ #### v-show
142142
143143```jsx
144144const App = {
@@ -151,14 +151,18 @@ const App = {
151151};
152152```
153153
154- v-model
154+ #### v-model
155155
156156> Note: You should pass the second param as string for using `arg`.
157157
158158```jsx
159159<input v-model={val} />
160160```
161161
162+ ```jsx
163+ <input v-model:argument={val} />
164+ ```
165+
162166```jsx
163167<input v-model={[val, ["modifier"]]} />
164168```
@@ -179,7 +183,7 @@ h(A, {
179183});
180184```
181185
182- v-models
186+ #### v-models (Not recommended since v1.1.0)
183187
184188> Note: You should pass a Two-dimensional Arrays to v-models.
185189
@@ -222,7 +226,18 @@ h(A, {
222226});
223227```
224228
225- custom directive
229+ #### custom directive
230+
231+ Recommended when using string arguments
232+
233+ ```jsx
234+ const App = {
235+ directives: { custom: customDirective },
236+ setup() {
237+ return () => <a v-custom:arg={val} />;
238+ },
239+ };
240+ ```
226241
227242```jsx
228243const App = {
You can’t perform that action at this time.
0 commit comments