1,直接上代码

el: '#flip-list-demo',

data: {

test:[],

items11: [

{number:1,name:'北京',money:8889},

{number:2,name:'广东',money:8888},

{number:3,name:'天津',money:8888},

],

items12:[

{number:4,name:'浙江',money:88888},

{number:5,name:'新疆',money:88888},

{number:6,name:'上海',money:88888},

{number:7,name:'上海',money:88888},

{number:8,name:'上海',money:88888},

{number:9,name:'上海',money:88888},

{number:10,name:'上海',money:88888},

{number:11,name:'上海',money:88888},

],

number: 'number',

activeIndex: 0 ,

},

computed: {

top : function(){

return - this.activeIndex * 34 + 'px';

},

strip: function(){

for(var i ; i < this.items11.length;i++){

this.test.push(parseInt(this.items11.money[i]/1000+'%'));

}

}

},

如何将items11里面的所有money算出百分比,然后v-for的时候将所得到的百分比的值再赋值给html中盒子的width?

Logo

前往低代码交流专区

更多推荐