摘要: Count.vue <template> <div> <h2>{{msg}}</h2><hr/> <h3> {{$store.state.count}} </h3> <p> <button @click="$store.commit('add')">+</button> <button @click 阅读全文
posted @ 2017-08-29 17:17 简单就好zyx 阅读(92) 评论(0) 推荐(0)
摘要: app.vue <button @click="goBack">后退</button> <button @click="go">前进</button> <button @click="goHome">返回首页</button> <script>export default { name: 'app' 阅读全文
posted @ 2017-08-29 15:23 简单就好zyx 阅读(128) 评论(0) 推荐(0)
摘要: 1.路由配置文件中写钩子函数 注:在路由文件中我们只能写一个beforeEnter,就是在进入此路由配置时。 // 配置路由export default [ { path: '/', name:'Hello', component:Hello },{ path:'/params/:newsId(\\ 阅读全文
posted @ 2017-08-29 15:10 简单就好zyx 阅读(347) 评论(0) 推荐(0)
摘要: router/index.js // 引用模板 import Error from '../components/Error.vue' // 配置路由export default [{ path:'*', component:Error } ] Error.vue <template> <div> 阅读全文
posted @ 2017-08-29 14:25 简单就好zyx 阅读(91) 评论(0) 推荐(0)
摘要: 去掉地址栏的# main.js const router = new VueRouter({ mode:'history', routes}) 址栏中带# mode:'hash', 阅读全文
posted @ 2017-08-29 14:16 简单就好zyx 阅读(206) 评论(0) 推荐(0)
摘要: app.vue <transition name="fade" mode="out-in" > <router-view></router-view> </transition> <style> .fade-enter{ opacity: 0;}.fade-enter-active{ transit 阅读全文
posted @ 2017-08-29 14:07 简单就好zyx 阅读(135) 评论(0) 推荐(0)