一、创建helloworld.vue组件
<template> <div> <h1>{{msg}}</h1> </div> </template> <script> export default{ name: 'hello', data () { return { msg: '你好,世界,这是第二页' } } } </script> <style> h1{ font-weight: normal; } </style> |
二、创建一个页面级组件test.vue
<template> </template> <script> <style> |
三、在router路由的index.html中配置路由
import Vue from 'vue' Vue.use(Router) export default new Router({ |
四、打开localhost:8080,看到效果