两性情感故事大全,维尼夫妇宝格丽戒指,dm800接收机
vue中vue-router的使用:
main.js如何配置(es6的写法):在引用之前记得先 npm 下所需要的vue
import vue from 'vue' import app from './app.vue' import router from 'vue-router' import resource from 'vue-resource' //import vuetouch from 'vue-touch' var vuetouch = require('vue-touch') //引入home页面 import homepage from './page/home.vue' //引入test页面 import test from './page/test.vue' vue.use(router); vue.use(resource); vue.use(vuetouch); var router = new router({ abstract: true, hashbang: false }); //实现页面跳转 router.map({ '/home':{ component:homepage }, '/test':{ component:test }, }) router.start(app, '#app') // router.go('test'); 默认直接跳转到 test 页面
中引入app.vue和build.js
<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>vue.js学习笔记(2)</title> <link rel="stylesheet" type="text/css" href="style/bootstrap.css"> </head> <body> <!--此处注意加载顺序,需要先加载dom在加载js,否则会'cannot find element: #app'--> <div id='app'></div> <script src="static/build.js"></script> </body> </html> <style> body { } </style>
app.vue引入router
<template> <div class='all-container'> <div class="public-content">我是公共页面</div> <div class='menu'> <ul class="list"> <li><a v-link='"/home"'>home页面</a></li> <li><a v-link='"/test"'>test页面</a></li> </ul> </div> <router-view transition='animation' class='container' keep-alive></router-view> </div> </template>
home.vue
<template> <div class="home"> <div class="htmleaf-content"> 我是home页面的内容 </div> </div> </template>
test.vue
<template> <div class="test"> <div class="test-content"> 我是test页面的内容 </div> </div> </template>
最后用webpack 将程序打包.关于webpack大家可以看看
本文已被整理到了《vue.js前端组件学习教程》,欢迎大家学习阅读。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
详解element上传组件before-remove钩子问题解决
vue.js中使用微信扫一扫解决invalid signature问题(完美解决)
网友评论