当前位置:网站首页>Wechat applet (function transfer parameters, transfer multiple parameters, page Jump)
Wechat applet (function transfer parameters, transfer multiple parameters, page Jump)
2022-06-13 06:11:00 【Vue sauce】
##1. Function arguments :
<!--bindtap-- Event name ;personalCollect-- Function name ; data-type--- Parameters -->
<text class="flex {
{collectType==0?'collectActive':''}}" bindtap="personalCollect" data-type="0"> travel </text>
<text class="flex {
{collectType==1?'collectActive':''}}" bindtap="personalCollect" data-type="1"> Photography </text>
js : Get parameter value
//js file
personalCollect (event) {
let num = event.currentTarget.dataset.type// obtain event Parameters transmitted
},
##2. Page Jump ( Jump to a new page )
<!-- wxml file -->
<!--bindtap Binding function , Click the jump -->
<view bindtap="onSkip"> Jump to the page </view>
//js file
onSkip () {
//wx.navigateTo: Keep the current page , Jump to a page in the app
//url: Page path to jump to
wx.navigateTo({
url: '../pages/sonPage/collect',
})
},
Jump through multiple parameters :
<!-- Parent page -->
<view bindtap="onSkip" data-url="./sonPage/details?id={
{article.id}}" data-city="{
{article.cityName}}">
onSkip(e) {
let url = e.currentTarget.dataset.url
let city = e.currentTarget.dataset.city
wx.navigateTo({
`${
url}&city=${
city}` // Each value uses & Separate , city To get better values for sub pages
})
},
// The child page gets the parameters of the parent page
onLoad:(options)=>{
console.log(options)// Here the bread contains the transmitted value
}
summary :
Function arguments : Because the development of wechat small program is different from the past ordinary web Development , Unable to get js obtain wxml Of documents dom structure , But you can use wechat applet data binding and view Labeled ”data-xx“ Custom properties to change the label class name , Pass value wxml Set up data-[ Parameter name ] Pass parameters ,[ Parameter name ] It can only be lowercase , It can't be capitalized
Page Jump : Page Jump also has a jump called wx.switchTab, It's a jump to tabBar page , And shut down all the others tabBar page , The usage is almost the same , Check out the official documentation
https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html
边栏推荐
- 万能播放器 PotPlayer 的下载与安装,直播流 m3u8 导入
- [to]12 common IP commands in the iproute installation package
- Record the basic use of zxing, the Google open source library, to generate and read QR codes
- Missing tag identification in cots RFID systems: bringing the gap between theory and Practice
- Leetcode- longest palindrome string - simple
- Adding classes dynamically in uni app
- How to view APK version number from apk
- Lamda expression
- Data conversion analysis tool
- Fragment lifecycle
猜你喜欢

智能数字资产管理助力企业决胜后疫情时代

AI实现亲人“复活”|老照片修复|老照片上色,免费APP推荐

USB 0xc0000011 error

The SQL file of mysql8.0 was imported into version 5.5. There was a pit
![[DP 01 backpack]](/img/be/1e5295684ead652eebfb72ab0be47a.jpg)
[DP 01 backpack]

You still can't remotely debug idea? Come and have a look at my article. It's easy to use

万能播放器 PotPlayer 的下载与安装,直播流 m3u8 导入

1+1>2,Share Creators可以帮助您实现

Echart line chart: different colors are displayed when the names of multiple line charts are the same

Intelligent digital asset management helps enterprises win the post epidemic Era
随机推荐
Leetcode- complement of numbers - simple
【ONE·Data || 带头双向循环链表简单实现】
免费录屏软件Captura下载安装
Time conversion'2015-04-20t11:12:00.000+0000 '
Leetcode fizz buzz simple
MySQL stored procedure
微信小程序:点击事件获取当前设备信息(基础)
Fusionpbx installation - road to dream
Test logiciel - résumé des FAQ d'interface
Not in the following list of legal domain names, wechat applet solution
Leetcode- number of words in string - simple
Data conversion analysis tool
Leetcode perfect number simple
Uniapp mobile terminal uses canvas to draw background convex arc
Leetcode- distribute cookies - simple
Experience of redis installation under Linux system (an error is reported at the same time. The struct redis server does not have a member named XXXX)
js-bom
[turn] explain awk (1)__ Awk Basics_ Options_ Program segment parsing and examples
USB debugging assistant 20181018 (v1.3)
Leetcode Hamming distance simple