//在Vue.js中相关代码
var nqy = [
{
path:'/',
component:{
template:`
<div>
<h1>首页</h1>
</div>
`,
}
} ,
{
path:'/user',
components:{
sidebar:{
template:`
<div>
<ul>
<li>用户列表</li>
<li>用户权限</li>
</ul>
</div>
`,
},
content:{
template:`
<div>how are you ? i am fine ,thank you , and you?how are you ? i am fine ,thank you , and you?</div>
`,
}
}
} ,
{
path:'/post',
components:{
sidebar:{
template:`
<div>
<ul>
<li>帖子列表</li>
<li>帖子权限</li>
</ul>
</div>
`,
},
content:{
template:`
<div>how are you ? i am fine ,thank you , and you?how are you ? i am fine ,thank you , and you?</div>
`,
}
}
} ,
];
var nyp = new VueRouter({
routes:nqy,
});
var app = new Vue({
el:'#app',
router:nyp,
methods:{
surf:function () {
setTimeout(function () {
this.nyp.push('/about');
setTimeout(function () {
this.nyp.push({name:'user',params:{name:'张三三'}})
},2000)
},2000)
}
}
});