uni-app根据不同的类型绑定不同类名

<template>
  <view class="page-demo">
     <view class="demo" 
       v-for="(item,index) in listArr" :key="index"
       :class="{'aa': item.type==1001,
       'bb': item.type==1002,
       'cc':item.type==1003,
       'dd':item.type==1004}">
	  {{item.cont }
     </view>
  </view>
</template>
<script>
	export default {
		data() {
			return {
				listArr:[
					{cont:"名称",type:1001},
					{cont:"名称",type:1002},
					{cont:"名称",type:1003},
					{cont:"名称",type:1004}
				]
			};
		},
	}
</script>

posted @ 2021-03-28 20:15  何人陪我共长生  阅读(457)  评论(0)    收藏  举报