@kaiyinchem/ky-uniui 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,14 +22,14 @@
22
22
  :class="{ active: i === tabIndex, icon: tab.icon }"
23
23
  :id="'ky_tab_'+i"
24
24
  class="ky-tab-item"
25
- @click="onTabClick(tab, i)"
25
+ @click="onTabClick(i)"
26
26
  >
27
27
  <text v-if="tab.icon" class="ky-tab-icon iconfont">{{ tab.icon }}</text>
28
28
  <text class="ky-tab-text">{{ tab[label] }}</text>
29
29
  </view>
30
30
  </view>
31
31
  <view
32
- v-if="tabItemWidth > 0 && !hasIcon"
32
+ v-if="tabItemWidth > 0"
33
33
  :style="{
34
34
  left: tabItemOffsetLeft + 'px',
35
35
  width: tabItemWidth + 'px',
@@ -109,31 +109,31 @@
109
109
  tabItemOffsetLeft: 0,
110
110
  tabItemWidth: 0,
111
111
  tabItemHeight: 2,
112
- tabIndex: 0,
112
+ tabIndex: -1,
113
113
  }
114
114
  },
115
115
  watch: {
116
116
  value(v) {
117
- this.tabIndex = v
117
+ this.onTabClick(v)
118
118
  }
119
119
  },
120
120
  computed: {
121
- hasIcon() {
122
- return this.menu.find(e => e.icon)
123
- },
124
121
  $safeBottom() {
125
122
  return uni.getSystemInfoSync().safeAreaInsets.bottom
126
123
  }
127
124
  },
128
125
  mounted() {
129
- if (!this.hasIcon) {
130
- this.onTabClick(this.menu[this.index], this.index)
131
- } else {
132
- this.tabIndex = typeof this.value !== 'undefined' ? this.value : this.index
133
- }
126
+ this.onTabClick(typeof this.value !== 'undefined' ? this.value : this.index)
134
127
  },
135
128
  methods: {
136
- onTabClick(item, index) {
129
+ onTabClick(index) {
130
+ console.log('当前索引:', index)
131
+ if (this.disabled) {
132
+ return
133
+ }
134
+ if (this.tabIndex === index) {
135
+ return
136
+ }
137
137
  this.$nextTick(() => {
138
138
  const query = uni.createSelectorQuery().in(this)
139
139
  query.select(`#ky-tab-wrap-${this.id}`).boundingClientRect()
@@ -148,29 +148,9 @@
148
148
  }
149
149
  })
150
150
  })
151
- if (this.disabled) {
152
- return
153
- }
154
- if (this.tabIndex === index) {
155
- return
156
- }
157
151
  this.tabIndex = index
158
152
  this.$emit('change', index)
159
153
  this.$emit('update:value', index)
160
- // tabEl.boundingClientRect(data => {
161
- // console.log(data)
162
- // this.tabItemWidth = data.width
163
- // this.tabItemOffsetLeft = data.left
164
- // if (this.type === 'card') {
165
- // this.tabItemHeight = data.height
166
- // }
167
- // if (this.tabIndex === index) {
168
- // return
169
- // }
170
- // this.tabIndex = index
171
- // this.$emit('change', index)
172
- // this.$emit('update:value', index)
173
- // }).exec()
174
154
  }
175
155
  }
176
156
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "locale"
10
10
  ],
11
11
  "description": "an uniapp ui",
12
- "version": "1.1.13",
12
+ "version": "1.1.14",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/yezipi/ky-uniui.git"