支付宝小程序自定义组件

子组件

index.js

Component({
  props: {
     classify_seleted: {
            type: String,
            value: ""
        },
    onTapClassify: () => {},
  },

  methods: {
     tapClassify(e){
           this.props.onTapClassify(e);
        }
  },
});

index.json

{
    "component": true,
    "usingComponents": {}
}

index.axml


父组件
index.js

const app = getApp();

Page({
  tapClassify() {
     console.log('子组件调用了');
  },
});

index.json

{
  "usingComponents": {
      "zdy-components": "/pages/component/zdy-components"
  }
}

index.axml


你可能感兴趣的:(支付宝小程序自定义组件)