从后台拿取有关css样式数据,前端怎么渲染
渲染方式一:后台把属性都已写好
<div id="app">
<div v-for="item in infos">
<div class="one" :style=item.length></div>
</div>
</div>
js
var app = new Vue({
el: '#app',
data: {
infos: [
{ 'length':"width:200px" },
{ 'length':"width:100px" },
{ 'length':"width:50px" }
]
}
});
渲染方式二:后台没有把属性写好
<div id="app">
<div v-for="item in infos">
<div class="one" :style="{width:item.length+'px'}"></div>
</div>
</div>
js
var app = new Vue({
el: '#app',
data: {
infos: [
{ 'length'::200 },
{ 'length':"100 },
{ 'length':50px }
]
}
});