vue路由+子路由+具名路由demo实例(结合animate.css动画)
来源:互联网 发布:邵阳学院网络教学平台 编辑:程序博客网 时间:2024/06/11 07:41
直接把代码copy下来自己运行吧
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>子路由</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <script src="https://cdn.bootcss.com/vue/2.3.3/vue.js"></script> <script src="https://cdn.bootcss.com/vue-router/2.5.3/vue-router.js"></script> <link href="https://cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet"> <style type="text/css"> html,body{overflow: hidden;} </style></head><body> <div id="box"> <p> <router-link to="/">首页</router-link> <router-link :to="{name:'list'}">列表</router-link> </p> <router-view name="shit"></router-view> <router-view></router-view> </div> <template id="index"> <div> <h1>首页</h1> <img src="http://t.cn/RaspUOe" width="200"> </div> </template> <template id="list"> <div> <p> <router-link v-for="item in items" :key="item.id" :to="{name:'list.rp',params:{rp:item.url}}"> {{item.text}} </router-link> </p> <transition enter-active-class="animated bounceInDown" leave-active-class="animated bounceOutLeft"> <router-view name="shit2"></router-view> </transition> <router-view></router-view> </div> </template> <template id="detail"> <div v-show="isShow"> <!-- <p>{{$route.params.rp}}</p> --> <img :src="$route.params.rp" width="100%"> </div> </template> <template id="footer"> <h3>i am footer</h3> </template> <script type="text/javascript"> const Index = { template:"#index" } const List = { template:"#list", data(){ return{ items:[ { text:'美女', url:'http://t.cn/RajyIIE', }, { text:'野兽', url:'http://t.cn/RasDspD', }, { text:'性感', url:'http://t.cn/Rask2ST' } ] } } } const Detail = { template:"#detail", data(){ return{ isShow:false } }, mounted(){ this.isShow = true } } const Footer = { template:"#footer" } let router = new VueRouter({ routes:[ { path:'/', components:{ shit:Index, default:List } }, { path:'/list', name:'list', component:List, 'children':[ { path:':rp', name:'list.rp', components:{ shit2:Detail, default:Footer } } ] }, { path:'*', component:Index } ] }); new Vue({ router, el:"#box" }) </script></body></html>
阅读全文
0 0
- vue路由+子路由+具名路由demo实例(结合animate.css动画)
- (一) Vue 路由+子路由
- vue 路由简单实例
- Vue动画 和 Vue路由
- rails路由url、具名路由规则
- Vue路由
- vue 路由
- Vue路由
- Vue路由
- vue路由
- Vue-路由
- vue 路由
- vue路由
- vue路由
- vue动态路由匹配实例
- 15、vue.js 之路由与子路由
- 路由
- 路由
- NETCTOSS项目(二)
- Windows学习(006)--对话框交互
- (部分原创)unity项目开发中VR工程的优化(下)
- idea 自定义方法注释模板(百分百管用)
- Mybatis动态拼接sql
- vue路由+子路由+具名路由demo实例(结合animate.css动画)
- (转)2017 年最流行的 15 个数据科学 Python 库
- Android实现侧滑菜单
- sql injection(sql 注入)
- 学习Linux命令(16)
- java继承关系中静态代码块、非静态代码块的执行顺序
- 2
- javascript数组
- 欢迎使用CSDN-markdown编辑器