WeChat applet Tab page Switch update data details

Source: Internet
Author: User
This article describes how to switch the Tab page of the applet to update data. For more information about how to switch the Tab page of the applet to update data, see the following article, for more information, see

The applet Tab page switches to update data.

The applet is still in the beta phase, and the most inconvenient thing is that the official website is constantly updating. the functions written in the previous few days suddenly become unavailable several days later )_

The functional requirements are as follows:

On the home page, I click "more than 50 thousand". he will jump to the "buy a car" page and bring the "more than 50 thousand" filter condition to the "buy a car" page.

GlobalData: {currentLocation: 'Beijing', selectCondition: '', userInfo: null}

In globalData, except userInfo, the other two variables included in the applet are defined by me.

2. click "50 thousand or above" on the "homepage" and perform two operations.

First, modify the value of the global variable selectCondition.

Second, jump to the Buy a Car page

You need to write in. js on the homepage:

addSelectCondition:function(e){    var con=e.currentTarget.dataset.hi;    app.globalData.selectCondition=con;    console.log(app.globalData.selectCondition)    wx.switchTab({     url: '../buycar/pickcar'    })  }

This is the content of the entire function. before the console, it is to modify the value of the global variable.

The code jumps to the "buy a car" tab page and uses wx. switchTab.

3. get the global variable selectCondition in the onShow function on the buy a car page and assign the value to the variable we have already defined in data, in this way, you can call the value of "more than 50 thousand" in "buy a car ".

Success, Sasa Hua

Thank you for reading this article. I hope it will help you. thank you for your support for this site!

The preceding section describes how to switch the update data on the Tab page of the applet. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.