Joke Collection Website - Public benefit messages - Wechat applet loops and page jumps.
Wechat applet loops and page jumps.
& lt opinion? bindtap="a "? data-f = " { { flag } } " & gt; 123</view & gt;
& lt! - ? Wx:for="{{ array}} "? Does the loop need a binding key? wx:key = " index "->;
& lt! - ? Bring your own definition? Articles? Represents each item in an array. Index? Represents the index of an array. -& gt;
& lt! - ? Modify the key of each value with wx:for-item? -& gt;
& lt! - ? Modify the index of each value with wx:for-index? -& gt;
& lt opinion? wx:for="{{list}} "? class="t "? wx:key="i "?
wx:for-item="r "? wx:for-index="i "
style="color:{{r.styFlag? Red':''}}; "
data-i="{{i}} "
Bindtap= "select"
& gt
{{r.name}} - {{i}}
& lt/view & gt;
Js content:
Data:? {
flag: 1,
List: ['ice mound',' snowmelt',' kimchi'],
List: [{
Name,' Ice Wharf',
StyFlag: that's right
},{
Name,' Snow Melting',
styFlag:false
},{
Name: "Little Pickle",
styFlag:false
}]
},
Option: Function (e)
Jean? {? currentTarget:{? Dataset: {i}? }? }? =? e;
/*? Step one, get the index of the clicked current content? */
console.log(i)
/*? Exclusive? Empty everything first? */
this . data . list . foreach(r = & gt; {
r.styFlag? =? wrong
})
this.data.list[i]。 styFlag? =? True;
/*? The data has changed? The point of view has not changed? SetData must be used to realize two-way data binding between data and views? */
this.setData({
List: this.data.list
})
},
Answer: Function (e){
console.log(e)
},
Effect:
Wxml content:
& lt button? bindtap="go 1 "? Style = "margin: 3px"> Zhang San
& lt button? bindtap="go2 "? Style = "margin: 3px"> Welcome back, master.
& lt opinion? wx:elif="{{msg=='lisi'}} "? Class="t "> Don't come until the faucet at home is broken.
& lt opinion? wx:elif="{{msg=='24'}} "? Class="t "> Hello, welcome to serve you.
& lt opinion? Wx: What else? Class="t "> indicates that no one is at home.
& lt/block & gt;
Js content:
Page ({
/**
? *? The initial data of the page
? */
Data:? {
Message: ""
},
goBack:function(){
wx.navigateBack()
},
/**
? *? Lifecycle Function-Monitor Page Loading
? */
Upload:? Function? (option)? {
console.log(options.name)
/*? Will using setData multiple times affect performance? Play setData as many times as possible? Use setData once to achieve it.
Use setData as little as possible to improve applet performance? */
this.setData({
Message: options.name
})
/*? What about Zhang San? The page says welcome back, master? */
/*? What if it's Li Si? The page shows that the faucet at home is not broken. Don't come over? */
/*? What if the name is number 24? The page shows hello, welcome to serve you? */
/*? Neither? Show no one at home? */
},
/**
? *? Lifecycle function-monitoring the completion of the first presentation of the page
? */
onReady:? Function? ()? {
},
/**
? *? Lifecycle Function-Monitor Page Display
? */
Ang Soo:? Function? ()? {
},
/**
? *? Lifecycle Function-Monitor Page Hiding
? */
onHide:? Function? ()? {
},
/**
? *? Lifecycle Function-Monitor Page Unloading
? */
onUnload:? Function? ()? {
},
/**
? *? Page-related event handling function-monitoring the user's drop-down action
? */
onPullDownRefresh:? Function? ()? {
},
/**
? *? Handler for page pull-down event.
? */
onReachBottom:? Function? ()? {
},
/**
? *? Users click on the top right corner to share.
? */
onShareAppMessage:? Function? ()? {
}
})
{
? "Page": [
"Pages/Index/Index",
"Pages/Pages/Pages",
"Page/My Page/My Page",
"Page/Log/Log",
"Page/Lei Feng/Lei Feng"
? ],
? "Window": {
" backgroundTextStyle ":? "darkness",
" navigationBarBackgroundColor ":? " #FF0000 ",
" navigationBarTitleText ":? " kw47page ",
" navigationBarTextStyle ":? "white"
? },
? “tabBar”:{
[color]:? " #fff ",
"Selected color":? " #FFCA28 ",
“backgroundColor”:"#000",
"List": [
? "Page path":? "Pages/Index/Index",
? "text": "home page",
? " iconPath ":? "",
? " selectedIconPath ":? ""
},? {
? "Page path":? "Page/Log/Log",
? "text": "log",
? " iconPath ":? "",
? " selectedIconPath ":? ""
}]
? },
? [style]:? “v2”,
? “sitemapLocation”:" sitemap.json "
}
Rendering:
- Previous article:Employment prospect and employment direction of information technology specialty
- Next article:Warm reminder of property hygiene
- Related articles
- Why do I always receive blessing messages from strange numbers, all of which are different numbers, and I am the only one with this situation, and there are several cards?
- Shenzhen law auction house is coming in spring! Legal interpretation of the adjustment of new taxes and fees
- What should I do if I want to cancel SMS notifications?
- Can I get compensation for defaming others by SMS?
- Will you call if you miss the postgraduate entrance examination?
- What is bank SMS signing? Does SMS signing count as mobile phone binding?
- I want to send SMS or MMS in groups. Who provides a more formal company? Don't be the kind of person who sends spam messages.
- Tanabata greetings are very short.
- My Huawei c8812e cannot send text messages. It shows that the message has not been sent, and then a red triangle with an exclamation mark inside appears. How to solve it?
- What should boys and girls do if their confession is rejected?