vue3 TS
無法識別vue對象this的屬性镰吵,報vue ts this報Property ‘x‘ does not exist on type
解決方法1:
// tsconfig.json
{
Strict:false
}
解決方法2:
this.name = 'cq'
// 改成下面的寫法
(this as any).name = 'cq'
vue-router
- route定義中刽锤,如何設(shè)置可選的params
解決方法:在參數(shù)后加引號?
帶引號贯卦,兩個路徑都能訪問
不帶引號,第一個不能訪問
http://aaa.com/product/8
http://aaa.com/product/8/6
{
name: 'product_detail',
path: '/product/:id/:type?',
component: () => import('/@pages/product/detail.vue')
}