如何创建组件 及 使用 这里不在多说;请参考之前文章

如何定义一个组件

自定义select下拉选项框组件使用

引用组件:

 <sub-unit-select  prop-array='{{selectArray}}' bind:myget='getDataSelect'></sub-unit-select>

也是自定义的属性  用来获取组件信息。例如我们要在引用页面 调用 组件内的方法。

onLoad: function(options) {
    console.log("album-details-onload");

    // 获取引用组件信息
    this.compData = this.selectComponent("#init")

  },
  // 自定义事件
 modalCancel(e) {
    console.log("album-details-modalCancel");
    var _this = this;
    this.compData.initData(); // initData 为组件中定义的函数

  },

 

相关文章:

  • 2022-12-23
  • 2021-07-03
  • 2021-05-27
  • 2021-06-25
  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
猜你喜欢
  • 2021-08-07
  • 2021-10-06
  • 2021-09-02
  • 2022-01-29
  • 2021-08-29
  • 2021-07-08
  • 2021-09-03
相关资源
相似解决方案