vue使用说明
url参数获取
import Qs from 'qs'
// hash模式
// const query = Qs.parse(location.hash.substring(3))
// history模式
const query = Qs.parse(location.search.substring(1))
let autoId = query.id
// console.log('autoId ' + autoId)
Vue.prototype.autoId = autoId
return {
autoId: this.autoId,
}
<div>设备编号:{{autoId}}</div>
vue 点击打开新窗口
<el-button type="primary" class="r" @click="getUrl">按钮</el-button>
methods中:
getUrl(){
let routeData = this.$router.resolve({ path: '/test' });
window.open(routeData.href, '_blank');
},
路由文件 router/index.js中:
{
path: '/test',
component: () => import('@/views/newPage/test'),
hidden: true
},