左侧边栏没有显示item.name
来源:17-2 左侧menu布局
慕雪0323865
2018-02-25
<template>
<div class="goods">
<div class="menu-wrapper">
<ul>
<li v-for="item in goods">
<span class="text">
<span v-show="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
</span>
</li>
</ul>
</div>
<div class="foods-wrapper"></div>
</div>
</template>
<script type="text/ecmascript-6">
import axios from 'axios';
const ERR_OK = 0;
export default {
props: {
seller: {
type: Object
}
},
data() {
return {
goods: []
};
},
created() {
this.classMap = ['decrease', 'discount', 'guarantee', 'invoice', 'special'];
var that = this;
axios.get('api/goods').then(function(response) {
response = response.data;
if (response.errno === ERR_OK) {
that.goods = response;
console.log(that.goods);
}
}).catch(function (error) {
console.log(error);
});
}
};
</script>
<style lang="stylus" rel="stylesheet/stylus">
.goods
display flex
position absolute
top 174px
bottom 46px
width: 100%
overflow hidden
.menu-wrapper
flex 0 0 80px
width 80px
background #f3f5f7
.goods-wrapper
flex 1
</style>写回答
1回答
-
ustbhuangyi
2018-02-26
有去对比我这里的源码吗:https://github.com/ustbhuangyi/vue-sell
032018-02-26
相似问题