vue3 TS
無(wú)法識(shí)別vue對(duì)象this的屬性,報(bào)vue ts this報(bào)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ù)后加引號(hào)?
帶引號(hào),兩個(gè)路徑都能訪問
不帶引號(hào),第一個(gè)不能訪問
http://aaa.com/product/8
http://aaa.com/product/8/6
{
name: 'product_detail',
path: '/product/:id/:type?',
component: () => import('/@pages/product/detail.vue')
}