html结构是这样的:
js代码是这样的:
var tools_list_arr = [
{
title: '在线云盘',
thisUrl: '/yunpan'
},
{
title: '作业系统',
thisUrl: '/zuoye',
children: [
{
title: '作业布置',
thisUrl: '/buzhi'
},
{
title: '作业评估',
thisUrl: '/pingu'
},
{
title: '作业查重',
thisUrl: '/chachong'
},
]
}
];
Vue.component('tools-list',{
template:'\
- \
\
{{item.title}}\
\
\
- \
\
{{childItem.title}}\
\
\
\
\
',
data: function(){
return {
items: tools_list_arr
};
}
})
new Vue({
el: '#left'
})
//路由
const Home = {
template: 'Home
'
}
const First = {
template: 'First
'
}
const routes = [
{path: '' , component: Home },
{path: '/qiandao' , component: First },
]
const router = new VueRouter({
routes : routes
})
const main = new Vue({
el: '#main',
router,
render: h => h(toolsList) //vue官方文档没这句,但网上查好像得添加这句,但我不知道h()的括号里写什么
}).$mount('#main')
报错如下
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
render
你已经添加了
el选项了就不用再添加render了