Hello ~ 前端要努力吖 ❤
✍刘有钱的前端问题库
一、设置浏览器自动打开
在package.json文件中
"scripts": {
"serve": "vue-cli-service serve --open --host=localhost",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
二、关闭eslint校验工具
在vue.config.js文件中:
module.exports = defineConfig({
lintOnSave: false,
})
三、如何在跳转路由时指定params参数可传可不传
如果在配置路由的时候占位了(如下)
const router = new VueRouter({
routes: [
{
name: 'search',
path: '/search/:keyword',
component: Search,
meta: {
show: true,
}
},
]
})
但是跳转路由的时候没传递params参数
this.$router.push({
name: 'search',
query: