微信小程序——绑定按键button

hello.js中代码

// pages/hello/hello.js
Page({

  
    data: {
        msg:"HELLO HOME"
    },
    update(){
        console.log(10000)
        this.setData({
            msg:"你好"
        })
    }

})

hello.wxml中代码:

<!--pages/hello/hello.wxml-->
<text>{
   
   {msg}}</text>
<button bindtap="update">修改</button>

 

 运行效果:

猜你喜欢

转载自blog.csdn.net/weixin_58963766/article/details/131615789
今日推荐