From cf7898bca75b761ce9caea660998045f94e46026 Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Thu, 30 Sep 2021 07:18:36 +0800 Subject: [PATCH] docs: update readme [ci skip] --- packages/babel-plugin-jsx/README-zh_CN.md | 23 +++++++++++++++---- packages/babel-plugin-jsx/README.md | 27 ++++++++++++++++++----- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/packages/babel-plugin-jsx/README-zh_CN.md b/packages/babel-plugin-jsx/README-zh_CN.md index 083fade..257cef3 100644 --- a/packages/babel-plugin-jsx/README-zh_CN.md +++ b/packages/babel-plugin-jsx/README-zh_CN.md @@ -134,7 +134,7 @@ const App = () => ; ### 指令 -v-show +#### v-show ```jsx const App = { @@ -147,7 +147,7 @@ const App = { }; ``` -v-model +#### v-model > 注意:如果想要使用 `arg`, 第二个参数需要为字符串 @@ -155,6 +155,10 @@ v-model ``` +```jsx + +``` + ```jsx ``` @@ -175,7 +179,7 @@ h(A, { }); ``` -v-models +#### v-models (从 1.1.0 开始不推荐使用) > 注意: 你应该传递一个二维数组给 v-models。 @@ -220,6 +224,17 @@ h(A, { 自定义指令 +只有 argument 的时候推荐使用 + +```jsx +const App = { + directives: { custom: customDirective }, + setup() { + return () => ; + }, +}; +``` + ```jsx const App = { directives: { custom: customDirective }, @@ -284,7 +299,7 @@ const App = { }; ``` -### 在 TypeSript 中使用 +### 在 TypeScript 中使用 `tsconfig.json`: diff --git a/packages/babel-plugin-jsx/README.md b/packages/babel-plugin-jsx/README.md index bba7b29..617c5c7 100644 --- a/packages/babel-plugin-jsx/README.md +++ b/packages/babel-plugin-jsx/README.md @@ -14,9 +14,9 @@ Install the plugin with: npm install @vue/babel-plugin-jsx -D ``` -Then add the plugin to .babelrc: +Then add the plugin to your babel config: -```js +```json { "plugins": ["@vue/babel-plugin-jsx"] } @@ -138,7 +138,7 @@ const App = () => ; ### Directives -v-show +#### v-show ```jsx const App = { @@ -151,7 +151,7 @@ const App = { }; ``` -v-model +#### v-model > Note: You should pass the second param as string for using `arg`. @@ -159,6 +159,10 @@ v-model ``` +```jsx + +``` + ```jsx ``` @@ -179,7 +183,7 @@ h(A, { }); ``` -v-models +#### v-models (Not recommended since v1.1.0) > Note: You should pass a Two-dimensional Arrays to v-models. @@ -222,7 +226,18 @@ h(A, { }); ``` -custom directive +#### custom directive + +Recommended when using string arguments + +```jsx +const App = { + directives: { custom: customDirective }, + setup() { + return () => ; + }, +}; +``` ```jsx const App = {