xt-element-ui 2.0.1 → 2.0.3

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.
@@ -2,7 +2,7 @@
2
2
  <div class="xt-step-price-item">
3
3
  <div class="xt-step-price-item__range">
4
4
  <span class="xt-step-price-item__bracket">{{ finalLeftBracket }}</span>
5
- <span v-if="itemsLength > 1" class="xt-step-price-item__name">第{{ index + 1 }}档</span>
5
+ <span v-if="itemsLength > 1" class="xt-step-price-item__name">第{{ index + 1 }}{{stepName}}</span>
6
6
  <span class="xt-step-price-item__bracket">{{ finalRightBracket }}</span>
7
7
  <xt-input
8
8
  v-model.number="minInput"
@@ -10,17 +10,18 @@
10
10
  size="small"
11
11
  placeholder="下限"
12
12
  class="xt-step-price-item__input"
13
- @blur="onMinBlur"
13
+ @blur="(e) => { onMinBlur(); onBlur(e) }"
14
14
  />
15
15
  <span class="xt-step-price-item__comma">-</span>
16
16
  <xt-input
17
17
  v-if="!isLast"
18
18
  v-model.number="maxInput"
19
+ type="number"
19
20
  :disabled="disabled"
20
21
  size="small"
21
22
  placeholder="上限"
22
23
  class="xt-step-price-item__input"
23
- @blur="onMaxBlur"
24
+ @blur="(e) => { onMaxBlur(); onBlur(e) }"
24
25
  />
25
26
  <span v-else class="xt-step-price-item__infinity">+∞</span>
26
27
  </div>
@@ -29,11 +30,12 @@
29
30
  <div class="xt-step-price-item__price">
30
31
  <xt-input
31
32
  v-model.number="priceInput"
33
+ type="number"
32
34
  :disabled="disabled"
33
35
  size="small"
34
36
  placeholder="价格"
35
37
  class="xt-step-price-item__input xt-step-price-item__input--price"
36
- @blur="onPriceBlur"
38
+ @blur="(e) => { onPriceBlur(); onBlur(e) }"
37
39
  />
38
40
  <span class="xt-step-price-item__unit">{{ unit }}</span>
39
41
  </div>
@@ -58,6 +60,7 @@ export default {
58
60
  required: true,
59
61
  default: () => ({ min: 0, max: null, price: 0 })
60
62
  },
63
+ stepName: { type: String, default: '阶梯' },
61
64
  index: { type: Number, default: 0 },
62
65
  isFirst: { type: Boolean, default: false },
63
66
  isLast: { type: Boolean, default: false },
@@ -177,13 +180,23 @@ export default {
177
180
  },
178
181
 
179
182
  onPriceBlur() {
180
- let v = this.safeNumber(this.priceInput, 0)
183
+ const rawVal = this.priceInput
184
+ if (rawVal === null || rawVal === undefined || rawVal === '' || isNaN(rawVal)) {
185
+ this.priceInput = ''
186
+ this.emitChange({ [this.keyPrice]: '' })
187
+ return
188
+ }
189
+ let v = this.safeNumber(rawVal, 0)
181
190
  if (v < 0) v = 0
182
191
  v = Number(v.toFixed(this.precision))
183
192
  this.priceInput = v
184
193
  this.emitChange({ [this.keyPrice]: v })
185
194
  },
186
195
 
196
+ onBlur(e) {
197
+ this.$emit('blur', e)
198
+ },
199
+
187
200
  onDelete() {
188
201
  this.$emit('delete', this.index)
189
202
  }
package/src/index.js CHANGED
@@ -37,6 +37,7 @@ import XtDatePicker from './components/xt-date-picker'
37
37
  import XtChart from './components/xt-chart' // XtChart 组件(基于 ECharts 封装)
38
38
  import XtIcon from './components/xt-icon' // XtIcon 组件(支持 el-icon / svg / 自定义字体)
39
39
  import XtTable from './components/xt-table' // XtTable 组件(基于 ElementUI Table 封装)
40
+ import XtScrollArrow from './components/xt-scroll-arrow'
40
41
 
41
42
 
42
43
  const components = [
@@ -60,7 +61,8 @@ const components = [
60
61
  XtDatePicker,
61
62
  XtChart,
62
63
  XtIcon,
63
- XtTable
64
+ XtTable,
65
+ XtScrollArrow
64
66
  ]
65
67
 
66
68
  const install = function (Vue, options = {}) {
@@ -129,7 +131,8 @@ export default {
129
131
  XtBadge,
130
132
  XtDatePicker,
131
133
  XtIcon,
132
- XtTable
134
+ XtTable,
135
+ XtScrollArrow
133
136
  }
134
137
 
135
138
  // XtChart 组件按需导出(使用时需自行安装 echarts 依赖)