


How to dynamically set placeholder prompt text and button selection/cancel status in WeChat applet
This article mainly introduces the method of WeChat applet to dynamically set placeholder prompt text and button selection/cancel state, involving event binding and related operation skills of dynamically setting attribute data of this.setData. Friends in need can refer to the following
The example of this article describes the method of WeChat applet to dynamically set placeholder prompt text and button selection and cancellation status. Share it with everyone for your reference, the details are as follows:
Rendering display
By binding the click event placeholder method, obtaindata-num value, use js to determine what num is equal to, and then use class="{{num==X?'active':''}}"
expression to determine which label In the selected state (that is, white text on a blue background);
js sets the dynamic value of the placeholder in the input input box by obtaining data-key
Content in wxml:
<view class="retrieve-list"> <p class="option"> <span bindtap="placeholder" data-num='1' data-key='' data-val='' class="{{num==1?'active':''}}">全部</span> <span bindtap="placeholder" data-num='2' data-key='标题' data-val='ti' class="{{num==2?'active':''}}">标题</span> <span bindtap="placeholder" data-num='3' data-key='摘要' data-val='ab' class="{{num==3?'active':''}}">摘要</span> <span bindtap="placeholder" data-num='4' data-key='申请人' data-val='ap' class="{{num==4?'active':''}}">申请人</span> <span bindtap="placeholder" data-num='5' data-key='申请号' data-val='an' class="{{num==5?'active':''}}">申请号</span> <span bindtap="placeholder" data-num='6' data-key='代理人' data-val='ag' class="{{num==6?'active':''}}">代理人</span> </p> <p class="option"> <span bindtap="placeholder" data-num='7' data-key='代理机构' data-val='ac' class="{{num==7?'active':''}}">代理机构</span> <span bindtap="placeholder" data-num='8' data-key='公开号' data-val='pn' class="{{num==8?'active':''}}">公开号</span> <span bindtap="placeholder" data-num='9' data-key='发明人' data-val='in' class="{{num==9?'active':''}}">发明人</span> <span bindtap="placeholder" data-num='10' data-key='专利权人' data-val='pa' class="{{num==10?'active':''}}">专利权人</span> </p> </view>
Content in js:
var app = getApp() Page({ data: { placeholder:'请输入', ph:'', num:1, key:'', }, placeholder:function(e){ var num = e.currentTarget.dataset.num this.setData({ ph: this.data.placeholder+e.currentTarget.dataset.key }) this.setData({ num: num }) })
The above is The entire content of this article is hoped to be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
A brief introduction to the tabs in the WeChat mini program
The WeChat mini program implements clicking buttons to move the view Label position function
WeChat applet realizes the function of clicking the button to change the font color
##
The above is the detailed content of How to dynamically set placeholder prompt text and button selection/cancel status in WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The default window overlapping in win11 is very annoying, so many friends want to cancel the overlapping windows, but don’t know how to cancel it. In fact, we only need to use relevant software. How to cancel overlapping windows in win11 Method 1: Cancel through the taskbar 1. Win11 does not have its own cancellation function, so we need to download a "startallback" 2. After the download is completed, "unzip" the compressed package. After the decompression is completed, open folder, run the illustrated installation program to complete the installation. . 3. After the installation is completed, you need to open the "Control Panel" and then change the "View by" in the upper right corner to "Large Icons". 4. In this way, you can find "startallback", click to open it, and enter the "Tasks" on the left

"The connection status in the event log message shows Standby: Disconnected due to NIC compliance. This means that the system is in standby mode and the network interface card (NIC) has been disconnected. Although this is usually a network issue , but can also be caused by software and hardware conflicts. In the following discussion, we will explore how to solve this problem." What is the reason for standby connection disconnection? NIC compliance? If you see the "ConnectivityStatusinStandby:DisConnected,Reason:NICCompliance" message in Windows Event Viewer, this indicates that there may be a problem with your NIC or network interface controller. This situation is usually

When placing orders using Meituan, users can choose to cancel the orders they do not want. Many users do not know how to cancel Meituan orders. Users can click on the My page to enter the order to be received, select the order that needs to be canceled and click Cancel. How to cancel an order with Meituan 1. First, click on Meituan My Page to enter the order to be received. 2. Then click to enter the order that needs to be canceled. 3. Click Cancel Order. 4. Click OK to cancel the order. 5. Finally, select the reason for cancellation according to your personal situation and click Submit.

In order to protect the screen content or save power, we often turn on the screen saver, but find it very troublesome to re-enter the password lock every time after exiting the screen saver. So how to cancel the win11 screen lock? In fact, it can be turned off in the screen saver settings. How to cancel the win11 screen lock: 1. First, we right-click a blank space on the desktop and open "Personalization" 2. Then find and open the "Lock Screen Interface" on the right 3. Then open the "Screen Saver" in the relevant settings at the bottom 4. Finally, check "Show login screen on restore" and confirm to save to cancel the screen lock.

Xianyu's official WeChat mini program has quietly been launched. In the mini program, you can post private messages to communicate with buyers/sellers, view personal information and orders, search for items, etc. If you are curious about what the Xianyu WeChat mini program is called, take a look now. What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3. If you want to use it, you must activate WeChat payment before you can purchase it;

1. The ear symbol is the voice receiver mode. First, we open WeChat. 2. Click me in the lower right corner. 3. Click Settings. 4. Find the chat and click to enter. 5. Uncheck Use earpiece to play voice.

When many users experience Mango TV, a video software, they choose to become members in order to enjoy more film and television resources and more comprehensive services. In the process of using Mango TV membership services, some users will choose to turn on the automatic renewal function to enjoy the discounts to ensure that they will not miss any exciting content. However, when users no longer need membership services or want to change the payment method, canceling the automatic renewal function is a very important thing to protect the safety of property. How to cancel the automatic renewal service of Mango TV? Users who want to know Come and follow this article to learn more! How to cancel the automatic renewal of membership on Mango TV? 1. First enter [My] in the Mango TV mobile APP, and then select [VIP Membership]. 2. Then find [Tube

You can open the management automatic renewal function on the My Gold VIP Member interface to cancel. Tutorial Applicable Model: Huawei P50 System: HarmonyOS2.0 Version: iQiyi 12.1.0 Analysis 1 Open the iQiyi app on your phone, and then enter the My page. 2 Then click Gold VIP Membership at the top of my page, and then click Manage Automatic Renewal Options. 3. Click Cancel automatic renewal in the pop-up window. If you are not interested, continue to cancel. 4Finally confirm to turn off automatic renewal and click I understand, just reject it cruelly. Supplement: How to cancel the automatic renewal function of iQiyi on Apple mobile phone 1. Open the settings on the phone, and then click [AppleID] at the top of the settings interface. 2Click [Subscribe] on the AppleID interface to select
