vant 2.13.6 → 2.13.7

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.
@@ -0,0 +1,17 @@
1
+ ### [v2.13.7](https://github.com/vant-ui/vant/compare/v2.13.2...v2.13.7)
2
+
3
+ `2025-04-25`
4
+
5
+ **Document**
6
+
7
+ - SwitchCell: remove SwitchCell in the form component [#12758](https://github.com/vant-ui/vant/issues/12758)
8
+ - add Rsbuild scaffold [a6983a](https://github.com/vant-ui/vant/commit/a6983a5ca2c6e4d9ff5410ae3cf6bb57a5ef2acc)
9
+ - changelog: vant v2.13.2 [#12373](https://github.com/vant-ui/vant/issues/12373)
10
+
11
+ **Feature**
12
+
13
+ - Sku: support sku properties [#13454](https://github.com/vant-ui/vant/issues/13454)
14
+
15
+ **release**
16
+
17
+ - 2.13.6 [e2ce4f](https://github.com/vant-ui/vant/commit/e2ce4fc397d8b9e6aa7ea292e9f1871c62517e32)
package/es/index.js CHANGED
@@ -87,7 +87,7 @@ import Tag from './tag';
87
87
  import Toast from './toast';
88
88
  import TreeSelect from './tree-select';
89
89
  import Uploader from './uploader';
90
- var version = '2.13.2';
90
+ var version = '2.13.7';
91
91
 
92
92
  function install(Vue) {
93
93
  var components = [ActionSheet, AddressEdit, AddressList, Area, Badge, Button, Calendar, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, ContactCard, ContactEdit, ContactList, CountDown, Coupon, CouponCell, CouponList, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, GoodsAction, GoodsActionButton, GoodsActionIcon, Grid, GridItem, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, List, Loading, Locale, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Panel, PasswordInput, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search, ShareSheet, Sidebar, SidebarItem, Skeleton, Sku, Slider, Step, Stepper, Steps, Sticky, SubmitBar, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, TreeSelect, Uploader];
package/es/sku/Sku.js CHANGED
@@ -30,6 +30,7 @@ export default createComponent({
30
30
  lazyLoad: Boolean,
31
31
  hideStock: Boolean,
32
32
  properties: Array,
33
+ skuProperties: Array,
33
34
  addCartText: String,
34
35
  stepperTitle: String,
35
36
  getContainer: [String, Function],
@@ -118,7 +119,8 @@ export default createComponent({
118
119
  selectedSku: {},
119
120
  selectedProp: {},
120
121
  selectedNum: 1,
121
- show: this.value
122
+ show: this.value,
123
+ currentSkuProperties: []
122
124
  };
123
125
  },
124
126
  watch: {
@@ -151,6 +153,9 @@ export default createComponent({
151
153
  }
152
154
  },
153
155
  computed: {
156
+ isSkuProperties: function isSkuProperties() {
157
+ return this.skuProperties && this.skuProperties.length;
158
+ },
154
159
  skuGroupClass: function skuGroupClass() {
155
160
  return ['van-sku-group-container', {
156
161
  'van-sku-group-container--hide-soldout': !this.showSoldoutSku
@@ -193,7 +198,7 @@ export default createComponent({
193
198
  selectedSkuComb: function selectedSkuComb() {
194
199
  var skuComb = null;
195
200
 
196
- if (this.isSkuCombSelected) {
201
+ if (this.isSkuCombSelected || this.isSkuProperties) {
197
202
  if (this.hasSku) {
198
203
  skuComb = getSkuComb(this.skuList, this.selectedSku);
199
204
  } else {
@@ -205,6 +210,8 @@ export default createComponent({
205
210
  }
206
211
 
207
212
  if (skuComb) {
213
+ // 更新当前规格属性数据
214
+ this.setCurrentSkuProperties(skuComb.id);
208
215
  skuComb.properties = getSelectedProperties(this.propList, this.selectedProp);
209
216
  skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
210
217
  return acc + (cur.price || 0);
@@ -242,7 +249,7 @@ export default createComponent({
242
249
  return this.sku.list || [];
243
250
  },
244
251
  propList: function propList() {
245
- return this.properties || [];
252
+ return this.isSkuProperties ? this.currentSkuProperties : this.properties || [];
246
253
  },
247
254
  imageList: function imageList() {
248
255
  var imageList = [this.goods.picture];
@@ -332,6 +339,14 @@ export default createComponent({
332
339
  this.$emit('after-sku-create', skuEventBus);
333
340
  },
334
341
  methods: {
342
+ setCurrentSkuProperties: function setCurrentSkuProperties(id) {
343
+ var _this$skuProperties;
344
+
345
+ var target = ((_this$skuProperties = this.skuProperties) == null ? void 0 : _this$skuProperties.find(function (item) {
346
+ return item.sku_id === id;
347
+ })) || {};
348
+ this.currentSkuProperties = target.properties || [];
349
+ },
335
350
  resetStepper: function resetStepper() {
336
351
  var skuStepper = this.$refs.skuStepper;
337
352
  var selectedNum = this.initialSku.selectedNum;
@@ -465,13 +480,22 @@ export default createComponent({
465
480
  var _extends2, _extends3;
466
481
 
467
482
  // 点击已选中的sku时则取消选中
468
- this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
483
+ this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3)); // 切换sku清空当前选择属性数据,触发prop-clear
484
+
485
+ if (this.isSkuProperties) {
486
+ this.selectedProp = {};
487
+ this.onPropClear();
488
+ }
489
+
469
490
  this.$emit('sku-selected', {
470
491
  skuValue: skuValue,
471
492
  selectedSku: this.selectedSku,
472
493
  selectedSkuComb: this.selectedSkuComb
473
494
  });
474
495
  },
496
+ onPropClear: function onPropClear() {
497
+ this.$emit('sku-prop-clear');
498
+ },
475
499
  onPropSelect: function onPropSelect(propValue) {
476
500
  var _extends4;
477
501
 
package/lib/index.js CHANGED
@@ -361,7 +361,7 @@ exports.TreeSelect = _treeSelect.default;
361
361
  var _uploader = _interopRequireDefault(require("./uploader"));
362
362
 
363
363
  exports.Uploader = _uploader.default;
364
- var version = '2.13.2';
364
+ var version = '2.13.7';
365
365
  exports.version = version;
366
366
 
367
367
  function install(Vue) {
package/lib/sku/Sku.js CHANGED
@@ -54,6 +54,7 @@ var _default2 = createComponent({
54
54
  lazyLoad: Boolean,
55
55
  hideStock: Boolean,
56
56
  properties: Array,
57
+ skuProperties: Array,
57
58
  addCartText: String,
58
59
  stepperTitle: String,
59
60
  getContainer: [String, Function],
@@ -142,7 +143,8 @@ var _default2 = createComponent({
142
143
  selectedSku: {},
143
144
  selectedProp: {},
144
145
  selectedNum: 1,
145
- show: this.value
146
+ show: this.value,
147
+ currentSkuProperties: []
146
148
  };
147
149
  },
148
150
  watch: {
@@ -175,6 +177,9 @@ var _default2 = createComponent({
175
177
  }
176
178
  },
177
179
  computed: {
180
+ isSkuProperties: function isSkuProperties() {
181
+ return this.skuProperties && this.skuProperties.length;
182
+ },
178
183
  skuGroupClass: function skuGroupClass() {
179
184
  return ['van-sku-group-container', {
180
185
  'van-sku-group-container--hide-soldout': !this.showSoldoutSku
@@ -217,7 +222,7 @@ var _default2 = createComponent({
217
222
  selectedSkuComb: function selectedSkuComb() {
218
223
  var skuComb = null;
219
224
 
220
- if (this.isSkuCombSelected) {
225
+ if (this.isSkuCombSelected || this.isSkuProperties) {
221
226
  if (this.hasSku) {
222
227
  skuComb = (0, _skuHelper.getSkuComb)(this.skuList, this.selectedSku);
223
228
  } else {
@@ -229,6 +234,8 @@ var _default2 = createComponent({
229
234
  }
230
235
 
231
236
  if (skuComb) {
237
+ // 更新当前规格属性数据
238
+ this.setCurrentSkuProperties(skuComb.id);
232
239
  skuComb.properties = (0, _skuHelper.getSelectedProperties)(this.propList, this.selectedProp);
233
240
  skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
234
241
  return acc + (cur.price || 0);
@@ -266,7 +273,7 @@ var _default2 = createComponent({
266
273
  return this.sku.list || [];
267
274
  },
268
275
  propList: function propList() {
269
- return this.properties || [];
276
+ return this.isSkuProperties ? this.currentSkuProperties : this.properties || [];
270
277
  },
271
278
  imageList: function imageList() {
272
279
  var imageList = [this.goods.picture];
@@ -356,6 +363,14 @@ var _default2 = createComponent({
356
363
  this.$emit('after-sku-create', skuEventBus);
357
364
  },
358
365
  methods: {
366
+ setCurrentSkuProperties: function setCurrentSkuProperties(id) {
367
+ var _this$skuProperties;
368
+
369
+ var target = ((_this$skuProperties = this.skuProperties) == null ? void 0 : _this$skuProperties.find(function (item) {
370
+ return item.sku_id === id;
371
+ })) || {};
372
+ this.currentSkuProperties = target.properties || [];
373
+ },
359
374
  resetStepper: function resetStepper() {
360
375
  var skuStepper = this.$refs.skuStepper;
361
376
  var selectedNum = this.initialSku.selectedNum;
@@ -489,13 +504,22 @@ var _default2 = createComponent({
489
504
  var _extends2, _extends3;
490
505
 
491
506
  // 点击已选中的sku时则取消选中
492
- this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? (0, _extends5.default)({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = _constants.UNSELECTED_SKU_VALUE_ID, _extends2)) : (0, _extends5.default)({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
507
+ this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? (0, _extends5.default)({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = _constants.UNSELECTED_SKU_VALUE_ID, _extends2)) : (0, _extends5.default)({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3)); // 切换sku清空当前选择属性数据,触发prop-clear
508
+
509
+ if (this.isSkuProperties) {
510
+ this.selectedProp = {};
511
+ this.onPropClear();
512
+ }
513
+
493
514
  this.$emit('sku-selected', {
494
515
  skuValue: skuValue,
495
516
  selectedSku: this.selectedSku,
496
517
  selectedSkuComb: this.selectedSkuComb
497
518
  });
498
519
  },
520
+ onPropClear: function onPropClear() {
521
+ this.$emit('sku-prop-clear');
522
+ },
499
523
  onPropSelect: function onPropSelect(propValue) {
500
524
  var _extends4;
501
525
 
package/lib/vant.js CHANGED
@@ -21088,6 +21088,7 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21088
21088
  lazyLoad: Boolean,
21089
21089
  hideStock: Boolean,
21090
21090
  properties: Array,
21091
+ skuProperties: Array,
21091
21092
  addCartText: String,
21092
21093
  stepperTitle: String,
21093
21094
  getContainer: [String, Function],
@@ -21176,7 +21177,8 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21176
21177
  selectedSku: {},
21177
21178
  selectedProp: {},
21178
21179
  selectedNum: 1,
21179
- show: this.value
21180
+ show: this.value,
21181
+ currentSkuProperties: []
21180
21182
  };
21181
21183
  },
21182
21184
  watch: {
@@ -21209,6 +21211,9 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21209
21211
  }
21210
21212
  },
21211
21213
  computed: {
21214
+ isSkuProperties: function isSkuProperties() {
21215
+ return this.skuProperties && this.skuProperties.length;
21216
+ },
21212
21217
  skuGroupClass: function skuGroupClass() {
21213
21218
  return ['van-sku-group-container', {
21214
21219
  'van-sku-group-container--hide-soldout': !this.showSoldoutSku
@@ -21251,7 +21256,7 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21251
21256
  selectedSkuComb: function selectedSkuComb() {
21252
21257
  var skuComb = null;
21253
21258
 
21254
- if (this.isSkuCombSelected) {
21259
+ if (this.isSkuCombSelected || this.isSkuProperties) {
21255
21260
  if (this.hasSku) {
21256
21261
  skuComb = getSkuComb(this.skuList, this.selectedSku);
21257
21262
  } else {
@@ -21263,6 +21268,8 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21263
21268
  }
21264
21269
 
21265
21270
  if (skuComb) {
21271
+ // 更新当前规格属性数据
21272
+ this.setCurrentSkuProperties(skuComb.id);
21266
21273
  skuComb.properties = sku_helper_getSelectedProperties(this.propList, this.selectedProp);
21267
21274
  skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
21268
21275
  return acc + (cur.price || 0);
@@ -21300,7 +21307,7 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21300
21307
  return this.sku.list || [];
21301
21308
  },
21302
21309
  propList: function propList() {
21303
- return this.properties || [];
21310
+ return this.isSkuProperties ? this.currentSkuProperties : this.properties || [];
21304
21311
  },
21305
21312
  imageList: function imageList() {
21306
21313
  var imageList = [this.goods.picture];
@@ -21390,6 +21397,14 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21390
21397
  this.$emit('after-sku-create', skuEventBus);
21391
21398
  },
21392
21399
  methods: {
21400
+ setCurrentSkuProperties: function setCurrentSkuProperties(id) {
21401
+ var _this$skuProperties;
21402
+
21403
+ var target = ((_this$skuProperties = this.skuProperties) == null ? void 0 : _this$skuProperties.find(function (item) {
21404
+ return item.sku_id === id;
21405
+ })) || {};
21406
+ this.currentSkuProperties = target.properties || [];
21407
+ },
21393
21408
  resetStepper: function resetStepper() {
21394
21409
  var skuStepper = this.$refs.skuStepper;
21395
21410
  var selectedNum = this.initialSku.selectedNum;
@@ -21523,13 +21538,22 @@ var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
21523
21538
  var _extends2, _extends3; // 点击已选中的sku时则取消选中
21524
21539
 
21525
21540
 
21526
- this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
21541
+ this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3)); // 切换sku清空当前选择属性数据,触发prop-clear
21542
+
21543
+ if (this.isSkuProperties) {
21544
+ this.selectedProp = {};
21545
+ this.onPropClear();
21546
+ }
21547
+
21527
21548
  this.$emit('sku-selected', {
21528
21549
  skuValue: skuValue,
21529
21550
  selectedSku: this.selectedSku,
21530
21551
  selectedSkuComb: this.selectedSkuComb
21531
21552
  });
21532
21553
  },
21554
+ onPropClear: function onPropClear() {
21555
+ this.$emit('sku-prop-clear');
21556
+ },
21533
21557
  onPropSelect: function onPropSelect(propValue) {
21534
21558
  var _extends4;
21535
21559
 
@@ -23204,7 +23228,7 @@ TreeSelect.props = {
23204
23228
 
23205
23229
 
23206
23230
 
23207
- var version = '2.13.2';
23231
+ var version = '2.13.7';
23208
23232
 
23209
23233
  function install(Vue) {
23210
23234
  var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, es_picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];