報錯詳情:Property 'id' does not exist on type 'query'.Vetur(2339)code
例如:對象
let query = {name: 'aa'} if (id) { query.id = id // Property 'id' does not exist on type 'query'.Vetur(2339) }
解決方法,添加代碼:string
interface queryObject { name: String [prop: string]: any } let query: queryObject = {name: 'aa'} if (id) { query.id = id }