@kaiyinchem/ky-uniui 1.1.13 → 1.1.16

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.
@@ -36,7 +36,7 @@
36
36
  </template>
37
37
 
38
38
  <script>
39
- const isDark = uni.getAppBaseInfo().theme
39
+ const isDark = uni.getAppBaseInfo().theme !== 'light'
40
40
  const windowInfo = uni.getWindowInfo()
41
41
 
42
42
  export default {
@@ -96,9 +96,9 @@
96
96
  const currVal = this.list[index]
97
97
  this.checked = this.ids[index]
98
98
  const valProps = this.setVal(this.value)
99
- if (valProps === this.checked) {
100
- return
101
- }
99
+ // if (valProps === this.checked) {
100
+ // return
101
+ // }
102
102
  this.index = index
103
103
  currVal.index = index
104
104
  this.$emit('update:value', this.checked)
@@ -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,12 +109,12 @@
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: {
@@ -126,14 +126,16 @@
126
126
  }
127
127
  },
128
128
  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
- }
129
+ this.onTabClick(typeof this.value !== 'undefined' ? this.value : this.index)
134
130
  },
135
131
  methods: {
136
- onTabClick(item, index) {
132
+ onTabClick(index) {
133
+ if (this.disabled) {
134
+ return
135
+ }
136
+ if (this.tabIndex === index) {
137
+ return
138
+ }
137
139
  this.$nextTick(() => {
138
140
  const query = uni.createSelectorQuery().in(this)
139
141
  query.select(`#ky-tab-wrap-${this.id}`).boundingClientRect()
@@ -148,29 +150,9 @@
148
150
  }
149
151
  })
150
152
  })
151
- if (this.disabled) {
152
- return
153
- }
154
- if (this.tabIndex === index) {
155
- return
156
- }
157
153
  this.tabIndex = index
158
154
  this.$emit('change', index)
159
155
  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
156
  }
175
157
  }
176
158
  }
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.16",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/yezipi/ky-uniui.git"