Skip to content

Commit a9efe4a

Browse files
committed
fix: rename createComponent to defineComponent
1 parent 9e62df9 commit a9efe4a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Including most of the API of Vue3. You can type `reactive`, choose `reactive`, a
2323
| `import` | `import {...} from "@vue/composition-api"` |
2424
| `import` | `import {...} from 'vue'` |
2525
| `newVue` | `newVue({...})` |
26-
| `createComponent` | `createComponent({...})` |
26+
| `defineComponent` | `defineComponent({...})` |
2727
| `export` | `export default { ... }` |
2828
| `setup` | `setup(${...}) {...}` |
2929
| `reactive` | `const data = reactive({...})` |
@@ -108,16 +108,16 @@ After installing the plugin you can use the Composition API to compose your comp
108108

109109
**This plugin requires TypeScript version >3.5.1. If you are using `vetur`, make sure to set `vetur.useWorkspaceDependencies` to `true`.**
110110

111-
To let TypeScript properly infer types inside Vue component options, you need to define components with `createComponent`:
111+
To let TypeScript properly infer types inside Vue component options, you need to define components with `defineComponent`:
112112

113113
**请使用最新版的 TypeScript,如果你使用了 `vetur`,请将 `vetur.useWorkspaceDependencies` 设为 `true`**
114114

115-
为了让 TypeScript 正确的推导类型,我们必须使用 `createComponent` 来定义组件:
115+
为了让 TypeScript 正确的推导类型,我们必须使用 `defineComponent` 来定义组件:
116116

117117
```ts
118-
import { createComponent } from '@vue/composition-api';
118+
import { defineComponent } from '@vue/composition-api';
119119

120-
const Component = createComponent({
120+
const Component = defineComponent({
121121
// 启用类型推断
122122
});
123123

snippets/javascript.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
],
1414
"description": "import"
1515
},
16-
"createComponent": {
17-
"prefix": "createComponent",
16+
"defineComponent": {
17+
"prefix": "defineComponent",
1818
"body": [
19-
"createComponent({",
19+
"defineComponent({",
2020
"\t$1",
2121
"})"
2222
],
23-
"description": "createComponent()"
23+
"description": "defineComponent()"
2424
},
2525
"export": {
2626
"prefix": "export default",

0 commit comments

Comments
 (0)