update vue guide
This commit is contained in:
parent
128c7dc95b
commit
0a2a4e915d
37
vue.md
37
vue.md
@ -15,7 +15,7 @@
|
||||
<script setup>
|
||||
|
||||
<!-- ts -->
|
||||
<script setup ts>
|
||||
<script setup lang="ts">
|
||||
```
|
||||
|
||||
* ##### 推荐使用Typescript/jsdoc开发
|
||||
@ -38,4 +38,39 @@
|
||||
|
||||
```
|
||||
|
||||
* ##### 布局组件文件使用xxxLayout结尾命名,如:
|
||||
```
|
||||
MainLayout
|
||||
DeviceLayout
|
||||
```
|
||||
|
||||
* ##### 页面文件使用xxxPage结尾命名,如:
|
||||
```
|
||||
DevicePage
|
||||
DeviceDetailPage
|
||||
```
|
||||
|
||||
* ##### 路由定义每个页面必须带上唯一name,通常与页面文件名一致,页面跳转统一使用name切换,不允许直接push路径方式,如:
|
||||
```
|
||||
{
|
||||
path: '/device',
|
||||
name: 'DevicePage',
|
||||
component: () => import('@/views/device/DevicePage.vue')
|
||||
}
|
||||
|
||||
跳转到页面时使用router.push({name: 'DevicePage'})
|
||||
|
||||
```
|
||||
|
||||
* ##### 不同组件间的引用尽量使用@/views/xxx/xxx.vue的路径方式,避免使用相对路径方式,如:
|
||||
```
|
||||
import DevicePage from '@/views/device/DevicePage.vue'
|
||||
有的项目为 src
|
||||
import DevicePage from '@/views/device/DevicePage.vue'
|
||||
```
|
||||
|
||||
* ##### 路由定义每个页面必须带上meta属性,其中meta.title为页面标题,meta.icon为页面图标,meta.keepAlive为页面是否需要缓存,如:
|
||||
|
||||
|
||||
|
||||
* ##### 待补充
|
||||
|
Loading…
Reference in New Issue
Block a user