File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,14 @@ vue create vue-next-project
56
56
57
57
这里在输入命令后,需要选择` Manually select features ` , 至少要把 ` babel ` ` typescript ` ` router ` 选上,(` vuex ` 看自身情况是否需要)。如下图:
58
58
59
- ![ ] ( https://user-gold-cdn.xitu.io/2020/5/22/1723b9c80913e36d?w=566&h=237&f= png&s=9590 )
59
+ ![ ] (https://github.com/vue3/vue3/vue3-router4-typescript/raw/master/assets/vue create project. png)
60
60
61
61
不清楚 vue-cli 的可参考[ 文章] ( https://juejin.im/post/5e69de93f265da570c75453e )
62
62
63
63
#### 3、升级为 vue3.x 项目
64
64
65
+ https://github.com/vuejs/vue-cli-plugin-vue-next
66
+
65
67
```
66
68
cd vue-next-project
67
69
vue add vue-next
@@ -73,8 +75,6 @@ vue add vue-next
73
75
74
76
接下来需要简单处理一下,使其支持 typescript 形式。(模板 cli 还没完善 typescript 的模板代码)
75
77
76
- ![ ] ( https://user-gold-cdn.xitu.io/2020/5/22/1723bb003f8fc297?w=965&h=520&f=png&s=30033 )
77
-
78
78
- 将` shims-vue.d.ts ` 文件中的内容修改一下,这步操作应该会少了一些报错。
79
79
80
80
```
@@ -136,7 +136,18 @@ export default defineComponent({
136
136
```
137
137
138
138
生命周期对应
139
- ![ ] ( https://user-gold-cdn.xitu.io/2020/5/22/1723bc18105dcd9f?w=488&h=319&f=png&s=15352 )
139
+
140
+ 与 2.x 版本生命周期相对应的组合式 API
141
+
142
+ beforeCreate → 使用 setup()
143
+ created → 使用 setup()
144
+ beforeMount → onBeforeMount
145
+ mounted → onMounted
146
+ beforeUpdate → onBeforeUpdate
147
+ updated → onUpdated
148
+ beforeDestroy → onBeforeUnmount
149
+ destroyed → onUnmounted
150
+ errorCaptured → onErrorCaptured
140
151
141
152
### 四、附上学习 vue-next 与 typescript 的官方秘籍
142
153
You can’t perform that action at this time.
0 commit comments