Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > js框架/js库

vue.js template模板的使用(仿饿了么布局)

来源:中文源码网    浏览:143 次    日期:2024-04-21 21:34:01
【下载文档:  vue.js template模板的使用(仿饿了么布局).txt 】


vue.js template模板的使用(仿饿了么布局)
使用template实现如下页面(仿饿了么布局)
如上图.使用了4个组件,分别是header.vue,goods.vue,ratings.vue,seller.vue
header.vue代码如下



goods.vue的代码如下,其他两个类似



在App.vue文件中,我们使用到了标签和
代码如下



index.js中这样写
import Vue from 'vue';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
//引入自定义的组件
import Goods from '@/components/goods/goods';
import Ratings from '@/components/ratings/ratings';
import Seller from '@/components/seller/seller';
Vue.use(VueRouter);
Vue.use(VueResource);
const routers = [{
path:'/goods/goods',
name:'goods',
component:Goods
},{
path:'/ratings/ratings',
name:'ratings',
component:Ratings
},{
path:'/seller/seller',
name:'seller',
component:Seller
}];
const router =new VueRouter({
mode:'history', //如果不配置 mode,就会使用默认的 hash 模式,该模式下会将路径格式化为 #! 开头。
routes:routers,
linkActiveClass : 'active' // 设置 链接激活时使用的 CSS 类名,默认值: "router-link-active"
});
export default router;
总结
以上所述是小编给大家介绍的vue.js template模板的使用(仿饿了么布局),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对中文源码网网站的支持!

相关内容