Mini Program Plugin

button

Insert picture description here

 <button size="mini" type="primary" open-type="contact" bindcontact="myfn">点击</button>
  <!-- <button bindtap="fn">点击触发事件</button> -->
  <button data-id="3" catch:tap="fn">点击触发事件</button>

Click to trigger event

Modified data
I will transform

 <view wx:if="{
     
     {show}}">我会变身</view>

I want to emphasize here: the parameters inside should use curly braces, which are different from those in vue

data: {
    
    
    message:"我是来测试的",
    show:true
  },
  fn(e){
    
    
    console.log(e);
    this.setData({
    
    
      message:"修改的数据",
      show: !this.data.show
    })
  },

mpvue build project
mpvue introduction

It is a front-end framework that uses Vue.js to develop small programs. The framework is based on the core of Vue.js. mpvue has modified the runtime and compiler implementation of Vue.js so that it can run in a small program environment, thus introducing a whole set of Vue.js development experience for the development of small programs
. The use of mpvue

# 全局安装 vue-cli
$ npm install --global vue-cli

# 创建一个基于 mpvue-quickstart 模板的新项目
$ vue init mpvue/mpvue-quickstart my-project

# 安装依赖
$ cd my-project
$ npm install
# 启动构建
$ npm run dev

Guess you like

Origin blog.csdn.net/weixin_54645137/article/details/113062089