vue1 到 vue2 v-el变成ref
vue1的写法
div class="menu-wrapper" v-el="menu-wrapper"> <ul class="menu"> <li v-for="item in goods" class="menu-item"> <span class="text"> <span v-if="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}} </span> </li> </ul> </div>
vue2的写法
<div class="menu-wrapper" ref=menuWrapper> <ul> <li v-for="(item,index) in goods" :key="index" class="menu-item"> <span class="text border-1px"> <span v-show="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}} </span> </li> </ul> </div>
methods: { _initScroll() { this.menuScroll = new BScroll(this.$refs.menuWrapper, {}); this.foodsScroll = new BScroll(this.$refs.foodsWrapper, {}); } }