riku
2023-11-29 9b09d13712c0c005891450a3bf4b6d848ec0ff37
component/switchtab/switchtab.js
@@ -8,6 +8,14 @@
   * 组件的属性列表
   */
  properties: {
    extClass: {
      type: String,
      value: ''
    },
    extClassOn: {
      type: String,
      value: ''
    },
    tabList: {
      type: Array,
      value: []
@@ -29,6 +37,17 @@
    // pageheight: '600px',
  },
  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () {
      // this.refreshHeight(true)
    },
    hide: function () { },
    resize: function () {
    },
  },
  /**
   * 组件的方法列表
   */
@@ -38,6 +57,7 @@
      if (e) {
        setTimeout(() => {
          const p = `.page${this.data.currentTab}`
          // console.log(p);
          this.tabsHeight(p);
        }, 50);
      }
@@ -45,7 +65,7 @@
    //计算swiper高度方法(在切换的时候调用)
    tabsHeight(element) {
      let that = this;
      let query = this.createSelectorQuery(); //必须要先创建一个查询
      let query = this.createSelectorQuery().in(this); //必须要先创建一个查询
      query.select(element).boundingClientRect(function (rect) {
        that.setData({
          pageheight: rect.height + 'px'