如题,我是新手,目前课设只需要一丢vue的知识,课设后再学多一点vue。
我设置了路由,入门的那种,正如vue文档里也一样,它的实例是
const NotFound = { template: '<p>Page not found</p>' }
const Home = { template: '<p>home page</p>' }
const About = { template: '<p>about page</p>' }
const routes = { '/': Home, '/about': About }
new Vue({ el: '#app',
data: { currentRoute: window.location.pathname },
computed: { ViewComponent () {
return routes[this.currentRoute] || NotFound } },
render (h) { return h(this.ViewComponent) } })
如果按上面来,那template就要直接写在里面,我的template都是很多内容的,而且直接塞进去会报错,就是不知道要如何放在外面然后可以导进来用,求解!QAQ
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…