uni-app循环——点击跳转

多个跳转模块,循环后跳转

<block v-for="(item,index) in btns" :key="index">
	<view class="holderBox" @click="toBtn(index)">
		<view class="holderDt">
			<image :src="$common.image(item.image)" mode="aspectFill"></image>
		</view>
		<view class="holderTXt">{
   
   {item.label}}</view>
	</view>
</block>


btns: [{
		image: '/static/images/1.png',
		value: 1,
		label: '标题1',
		url: '/pages/one/one'
	},
	{
		image: '/static/images/2.png',
		value: 2,
		label: '标题2',
		url: '/pages/two/two'
	},
	{
		image: '/static/images/3.png',
		value: 3,
		label: '标题3',
		url: '/pages/three/three'
	},
]


methods: {
	toBtn(index) {
		this.$common.to(this.holderBtns[index].url)
	},
}

猜你喜欢

转载自blog.csdn.net/xulihua_75/article/details/126944630