当前位置:首页 > 微信 > 正文

微信小程序开发(二)点击事件

11-26 微信

标签:dex   微信   console   color   事件   alt   ndt   tap   属性   

接着上篇博客继续。

如下修改:

// index.wxml
<view>Hello World!</view>

<button bindtap="but">点击按钮</button>  // 按钮 bindtap属性就是添加点击事件,名字是but

// index.js
Page({
  but: function(){  // 通过but点击事件触发后面的函数
    console.log("你好")
  }
})

保存代码后,点击按钮效果如下:

技术图片

 

微信小程序开发(二)点击事件

标签:dex   微信   console   color   事件   alt   ndt   tap   属性   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15999.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266822访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接