小程序中给每一个元素的id动态赋值
index.wxml
<text class="user-motto" id="user-{{userId}}">{{motto}}</text>index.js
//index.js//获取应用实例const app = getApp()Page({ data: { motto: 'Hello World1', userId: '123' }, onLoad: function () { }, onShow: function(){ // app.globalData.userInfo="wxopen.club"; }})
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

