微信for简单使用:
<view>
<ul>
<li wx:for="{{xiaoke}}" wx:key="index">
<a href="{{item.path}}">{{item.name}}</a>
</li>
</ul>
</view>
其中" xiaoke " 是数组名称," index"是数组下标。
//.js文件内容
Page({
data: {
xiaoke: [
{
name: '测试',
path: 'pages/wode/index'
},{
name:'测试',
path: 'pages/wode/index'
},{
name:'测试',
path: 'pages/wode/index'
},{
name:'测试',
path: 'pages/wode/index'
}],
}
})
----------------------
标签:index,name,微信,程序,wode,循环,path,xiaoke,pages From: https://blog.csdn.net/m0_74358570/article/details/141601013