试题
考点

js语言和框架-vue.js-基本语法-if\show

面5笔5

Vue的路由的传参方式正确的有()

A.this.$router.push({path:'',query:{}})

B.this.$route.push({path:'',params:{}})

C.this.$router.push({path:`/describe/${id}`})

D.this.$route.push({path:`/describe/${id}`})

前往“校招VIP”小程序,刷题更快
最新校招难题刷题,快来进刷题群吧
解答

正确答案是 C

重点:$router 注意后面有r

// 字符串

this.$router.push('/home/first')

// 对象

this.$router.push({ path: '/home/first' })

// 命名的路由

this.$router.push({ name: 'home', params: { userId: wise }})


评论

紫侠仙子

2023-03-06 22:00:00

0 0

加载更多