vue router html后缀,vue-router-demo.html

Vue入门之extend全局方法

ul, li { list-style: none; }

ul { overflow: hidden; }

li { float: left; width: 100px; }

h2 { background-color: #903;}


email to: {{ email }}


var topbarTemp = `

  • {{ item.name }}

`;

// 定义组件:topbar

Vue.component('top-bar', {

template: topbarTemp,

data: function () {

return {

NavList: [

{ name: '首页', url: '/home'},

{ name: '产品', url: '/product'},

{ name: '服务', url: '/service'},

{ name: '关于', url: '/about'}

]

}

}

});

Vue.component('footer-bar', {  // 定义组件 footerbar

template: `


版权所有@flydragon

`

});

// 创建home模块

var home = {

template: `

{{ msg }}

`,

data: function () {

return { msg: 'this is home view' }

}

};

// 创建product 模块

var product = {

template: `

{{ msg }}

`,

data: function () {

return { msg: 'this is product view' }

}

}

// 创建service 模块

var service = {

template: `

{{ msg }}

`,

data: function () {

return { msg: 'this is service view' }

}

}

// 创建about 模块

var about = {

template: `

{{ msg }}

`,

data: function () {

return { msg: 'this is about view' }

}

}

// 定义路由对象

var router = new VueRouter({

routes: [

{ path: '/home', component: home },

{ path: '/product', component: product },

{ path: '/service', component: service },

{ path: '/about', component: about }

]

});

// 初始化一个Vue实例

var app = new Vue({

el: '#app',

data: {

email: 'flydragon@gmail.com'

},

router: router

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值