采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
老师,在二期代码中,为什么不再使用created()函数了,取而代之的是什么
老师,有一个新的问题,如何做到只定义路由,而不会在tabbar上显示出来。
没太明白你的问题啊
哈哈,我再描述下需求: 1、如何通过url做到tab的切换,像#/goods, #/ratings 2、在1的基础上,我有3个tab,路由分别是 #/goods, #/ratings, #/seller, 我可以再加一个路由 #/order,但是这个不想放到tab里面,只是用来做页面切换。可以实现吗?(我的理解是cube-ui结合vue-router) 老师可以具体讲讲吗? 再具体一点: location.href = 'http:xxx/sell/pay/create' + '?openid=' + this.getCookie('openid') + '&orderId=' + respones.data.orderId + '&returnUrl=' + encodeURIComponent('http:xxx' + '/#/order/' + respones.data.orderId) 我想实现如上跳转到order.vue,但是不知道怎么做。 使用了vue-router,但是不生效,如下: Vue.use(VueRouter) const routes = [{ path: '/pay', component: Pay }, { path: '/order', component: Pay }, { path: '/order/:orderId', component: Pay }, { path: '/goods', component: Goods }, { path: '/ratings', component: Ratings }, { path: '/seller', component: Seller }] const router = new VueRouter({ routes: routes }) new Vue({ router, render: h => h(App) }).$mount('#app')
tabbar 可以和路由配合使用,第二点也是可以的,你只需要定义多个 router-view 即可,参考 https://router.vuejs.org/zh/guide/essentials/named-views.html#%E5%B5%8C%E5%A5%97%E5%91%BD%E5%90%8D%E8%A7%86%E5%9B%BE
老师,我在created中添加了
var abc = 123 console.log(abc) abc = 1212 console.log(abc)
每次刷新页面都会打印如下内容,说明created被调用了两次吧,这是已知问题吗?
goods.vue:139 123
goods.vue:141 1212
老师,明白了怎么回事。
我在goods.vue中使用了,然后location.href重定位到另一个页面,导致页面不断刷新,老师可以提示下吗
你把代码传到 GitHub 上,我抽空帮你看下
你说的是 created 钩子函数吗,还会用的呀
登录后可查看更多问答,登录/注册
掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp
3.3k 21
1.7k 21
1.9k 20
1.8k 18
2.1k 17
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号