WeChat applet development notes (4) --- binding click event, input binding trigger event (two types) and input value

Preface

本文为微信小程序开发笔记,现学现卖,正在学习中。
如有发现问题或者发现有什么不足的地方,请大佬们多多指教!!!(开发自己的微信小程序中……)

-目录
	-绑定点击事件
	-input绑定触发事件(两种)和input取值
  • Bind the click event

    	<view>
          <view> {
          
          {
          
          text}}</view>
          <button bindtap="changeText">按钮</button>
      	</view>
    
       Page({
          
          
       		data: {
          
          
       			text: "点击前"
       		},
       	
    		changeText: function () {
          
          
       		this.setData({
          
          
     				text: '点击后'
       			})
    		}
       })
    
  • Input binding trigger event (two types) and input value

Look at the development documentation first to find the effect you want.
Insert picture description here
Example bindinput event
Effect: trigger once the content of the input box changes once

<input  bindinput='changeInput'  type='text' placeholder='请输入……'></input>
   changeInput(e){
    
    
     console.log(e.detail) 
   }

Guess you like

Origin blog.csdn.net/qq_43815329/article/details/114979793