<<<<<<< HEAD
A Vue.js project
'|-- src', ' |-- 01.jpg', ' |-- App.vue', ' |-- main.js', ' |-- test.js', ' |-- assets', ' | |-- logo.png', ' | |-- images', ' | |-- 10.jpg', ' | |-- nav_1.png', ' | |-- nav_2.png', ' | |-- nav_3.png', ' | |-- nav_4.png', ' | |-- nav_5.png', ' | |-- nav_6.png', ' |-- components', ' | |-- concat', ' | | |-- Concat.vue', ' | |-- home', ' | | |-- goodList.vue', ' | | |-- goodListInfo.vue', ' | | |-- HomeContainer.vue', ' | | |-- HomenewListContainer.vue', ' | | |-- newsInfo.vue', ' | | |-- photoList.vue', ' | |-- public', ' | | |-- comments.vue', ' | | |-- goodList_numbox.vue', ' | | |-- lunbo.vue', ' | | |-- shoppingCar_numbox.vue', ' | |-- search', ' | | |-- Search.vue', ' | |-- shoppingcar', ' | |-- ShoppingCar.vue', ' |-- lib', ' | |-- mui', ' | |-- css', ' | | |-- iconfont.css', ' | | |-- icons-extra.css', ' | | |-- mui.css', ' | | |-- mui.min.css', ' | | |-- mui.picker.css', ' | | |-- mui.poppicker.css', ' | |-- fonts', ' | | |-- iconfont.ttf', ' | | |-- mui-icons-extra.ttf', ' | | |-- mui.ttf', ' | |-- js', ' | |-- mui.js', ' | |-- mui.min.js', ' | |-- mui.picker.js', ' | |-- mui.poppicker.js', ' |-- router', ' |-- index.js',
####2.container区域用router-view来实现单页面多组件切换
####3.由于mui样式对vue自身router-view的样式覆盖,在mounted钩子函数中重新绑定a链接跳转
2.2 Vue.http.options.root = 'http://localhost:9090/'
Vue.filter('dateFormat',function(date,format = 'YYYY-MM-DD') {
return new moment(date).format(format);
})
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>',
store
})
2.methods中声明获取轮播图数据getlunbo(),获取商品详情getGoodInfo,半场动画的三个钩子函数beforeEnter,enter,afterEnter用来实现小球动画,获取选中商品数量getSelectedCount,用来获取shoppingCar_numbox公共子组件的值,添加购物车商品方法addToCar,将商品信息对象提交commit到store中的addToCar
data() {
return {
shoppingInfo : [],
shoppingCount : {},
selected : {},
selectedGoods : {}
}
},
mui('.mui-switch')['switch']()
3.methods中声明获取删除修改商品的方法和获取所有选中商品价格数量的方法,getshoppingInfo根据state中goodsInfo遍历成员id,ajax获取所有商品信息,remove删除本组件shoppingInfo中的子成员,并通过commit提交deleteFromCar实现本地化数据同步,vuex中数据同步,updateSelected更新本组件selected中子成员值,并通过commit提交updateSelected实现本地化数据同步,getAllSelected通过getters中的getAllSelected获取选中商品的价格和数量
data() {
return {
comments: [],
pageIndex : 1,
user : null,
user_comment : null
}
},
2.methods中声明获取评论数据方法getComments,根据父组件传进来的id值和pageindex从后台接口获取数据,获取更多评论方法getMore,pageindex++,重新调用一次getComments方法,评论提交方法post,先提交到后台数据,更新本组件的comments,用Array的unshift方法在数组头添加评论对象
=======
For a detailed explanation on how things work, check out the guide and docs for vue-loader.
56610a3db1f7eb533a7d394c3e56ccf20742b8c4