@aochuang/common 1.0.127 → 1.0.128

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.
@@ -20,8 +20,8 @@
20
20
  <el-dropdown-item
21
21
  class="ui-dropdown__item"
22
22
  v-for="(item, index) in showOptions"
23
- :key="index"
24
- :command="index"
23
+ :key="item.id || ((item.value || item.label || 'item') + '-' + index)"
24
+ :command="{ index, item }"
25
25
  :divided="item.divided || (item.props && item.props.divided)"
26
26
  :disabled="item.disabled || (item.props && item.props.disabled)"
27
27
  :class="handleRenderItemClass(item)"
@@ -168,7 +168,11 @@ export default {
168
168
  return cls
169
169
  },
170
170
  handleCommand (e) {
171
- const item = this.showOptions[e]
171
+ const index = e && typeof e === 'object' ? e.index : e
172
+ const item = e && typeof e === 'object' ? e.item : this.showOptions[e]
173
+ if (!item) {
174
+ return
175
+ }
172
176
  // 兼容以前的老逻辑,如果配置了item-click就不允许执行item.click了,因为后面新的方式可以直接监听dropdown-item的时间,能带上下文数据
173
177
  if (!this.$listeners['item-click']) {
174
178
  if (item.click) {
@@ -177,7 +181,7 @@ export default {
177
181
  }
178
182
  this.$emit('input', item.value)
179
183
  this.$emit('item-click', {
180
- index: e,
184
+ index,
181
185
  item,
182
186
  itemData: this.itemData
183
187
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/common",
3
- "version": "1.0.127",
3
+ "version": "1.0.128",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {