@nutui/nutui 3.1.19-beta.0 → 3.1.19-beta.1
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.
- package/dist/nutui.d.ts +38 -37
- package/dist/nutui.es.js +13439 -12616
- package/dist/nutui.umd.js +13431 -12695
- package/dist/packages/_es/ActionSheet.js +12 -18
- package/dist/packages/_es/Address.js +78 -69
- package/dist/packages/_es/Audio.js +12 -12
- package/dist/packages/_es/AudioOperate.js +1 -1
- package/dist/packages/_es/Avatar.js +3 -3
- package/dist/packages/_es/BackTop.js +68 -110
- package/dist/packages/_es/Badge.js +3 -3
- package/dist/packages/_es/Barrage.js +62 -55
- package/dist/packages/_es/Button.js +2 -2
- package/dist/packages/_es/Calendar.js +28 -23
- package/dist/packages/_es/CalendarItem.js +3 -3
- package/dist/packages/_es/Card.js +6 -5
- package/dist/packages/_es/Cascader.js +7 -7
- package/dist/packages/_es/Cell.js +4 -11
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +1 -1
- package/dist/packages/_es/CircleProgress.js +149 -40
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +34 -8
- package/dist/packages/_es/CollapseItem.js +90 -59
- package/dist/packages/_es/CountDown.js +5 -5
- package/dist/packages/_es/CountUp.js +43 -51
- package/dist/packages/_es/DatePicker.js +21 -20
- package/dist/packages/_es/Dialog.js +8 -86
- package/dist/packages/_es/Divider.js +4 -4
- package/dist/packages/_es/Drag.js +92 -54
- package/dist/packages/_es/Elevator.js +74 -49
- package/dist/packages/_es/Empty.js +3 -3
- package/dist/packages/_es/FixedNav.js +5 -5
- package/dist/packages/_es/Form.js +4 -4
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +8 -26
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +15 -84
- package/dist/packages/_es/Indicator.js +3 -3
- package/dist/packages/_es/InfiniteLoading.js +93 -107
- package/dist/packages/_es/Input.js +8 -8
- package/dist/packages/_es/InputNumber.js +23 -16
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/List.js +41 -34
- package/dist/packages/_es/Menu.js +15 -12
- package/dist/packages/_es/MenuItem.js +9 -9
- package/dist/packages/_es/Navbar.js +3 -4
- package/dist/packages/_es/NoticeBar.js +47 -40
- package/dist/packages/_es/Notify.js +29 -168
- package/dist/packages/_es/NumberKeyboard.js +5 -10
- package/dist/packages/_es/OldPicker.js +122 -120
- package/dist/packages/_es/OverLay.js +5 -25
- package/dist/packages/_es/Pagination.js +7 -7
- package/dist/packages/_es/Picker.js +39 -16
- package/dist/packages/_es/Popover.js +155 -30
- package/dist/packages/_es/Popup.js +8 -71
- package/dist/packages/_es/Price.js +17 -5
- package/dist/packages/_es/Progress.js +18 -8
- package/dist/packages/_es/PullRefresh.js +1 -1
- package/dist/packages/_es/Radio.js +2 -2
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +46 -33
- package/dist/packages/_es/Rate.js +16 -19
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +8 -6
- package/dist/packages/_es/ShortPassword.js +89 -67
- package/dist/packages/_es/SideNavBar.js +5 -16
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +69 -88
- package/dist/packages/_es/Skeleton.js +8 -11
- package/dist/packages/_es/Sku.js +47 -56
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +28 -23
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +39 -26
- package/dist/packages/_es/Swiper.js +31 -13
- package/dist/packages/_es/SwiperItem.js +1 -1
- package/dist/packages/_es/Switch.js +3 -3
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +3 -3
- package/dist/packages/_es/TabbarItem.js +17 -23
- package/dist/packages/_es/Table.js +13 -13
- package/dist/packages/_es/Tabs.js +21 -20
- package/dist/packages/_es/Tag.js +4 -4
- package/dist/packages/_es/TextArea.js +44 -42
- package/dist/packages/_es/TimeDetail.js +4 -3
- package/dist/packages/_es/TimePannel.js +3 -3
- package/dist/packages/_es/TimeSelect.js +8 -7
- package/dist/packages/_es/Toast.js +41 -170
- package/dist/packages/_es/Uploader.js +109 -138
- package/dist/packages/_es/Video.js +3 -3
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +44 -6
- package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
- package/dist/packages/_es/index2.js +1 -1
- package/dist/packages/_es/index3.js +56 -28
- package/dist/packages/_es/index4.js +413 -56
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/uploader/index.scss +2 -2
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +61 -61
- package/dist/styles/themes/jdt.scss +61 -61
- package/package.json +1 -1
- package/dist/packages/_es/raf.js +0 -19
package/dist/packages/_es/Sku.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
3
|
* (c) 2022 @jdf2e.
|
|
23
4
|
* Released under the MIT License.
|
|
24
5
|
*/
|
|
@@ -26,10 +7,6 @@ import { resolveComponent, openBlock, createElementBlock, createElementVNode, re
|
|
|
26
7
|
import { c as createComponent } from "./component.js";
|
|
27
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
28
9
|
import { T as TypeOfFun } from "./util.js";
|
|
29
|
-
import { popupProps } from "./Popup.js";
|
|
30
|
-
import "./OverLay.js";
|
|
31
|
-
import "./Icon.js";
|
|
32
|
-
import "./pxCheck.js";
|
|
33
10
|
const { componentName: componentName$4, create: create$4 } = createComponent("sku-header");
|
|
34
11
|
const _sfc_main$4 = create$4({
|
|
35
12
|
props: {
|
|
@@ -91,13 +68,13 @@ const _sfc_main$3 = create$3({
|
|
|
91
68
|
skuInfo.value = [].slice.call(props.sku);
|
|
92
69
|
}
|
|
93
70
|
});
|
|
94
|
-
const changeSaleChild = (attrItem,
|
|
71
|
+
const changeSaleChild = (attrItem, index, parentItem, parentIndex) => {
|
|
95
72
|
if (attrItem.checkFlag || attrItem.disable) {
|
|
96
73
|
return;
|
|
97
74
|
}
|
|
98
75
|
emit("selectSku", {
|
|
99
76
|
sku: attrItem,
|
|
100
|
-
skuIndex:
|
|
77
|
+
skuIndex: index,
|
|
101
78
|
parentSku: parentItem,
|
|
102
79
|
parentIndex
|
|
103
80
|
});
|
|
@@ -114,7 +91,7 @@ const _hoisted_3$2 = { class: "nut-sku-select-item-skus" };
|
|
|
114
91
|
const _hoisted_4$2 = ["onClick"];
|
|
115
92
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
93
|
return openBlock(), createElementBlock("view", _hoisted_1$3, [
|
|
117
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.skuInfo, (item,
|
|
94
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.skuInfo, (item, index) => {
|
|
118
95
|
return openBlock(), createElementBlock("view", {
|
|
119
96
|
class: "nut-sku-select-item",
|
|
120
97
|
key: item.id
|
|
@@ -124,7 +101,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
124
101
|
(openBlock(true), createElementBlock(Fragment, null, renderList(item.list, (itemAttr, itemAttrIndex) => {
|
|
125
102
|
return openBlock(), createElementBlock("view", {
|
|
126
103
|
class: normalizeClass(["nut-sku-select-item-skus-sku", [{ active: !itemAttr.disable && itemAttr.active }, { disable: itemAttr.disable }]]),
|
|
127
|
-
onClick: ($event) => _ctx.changeSaleChild(itemAttr, itemAttrIndex, item,
|
|
104
|
+
onClick: ($event) => _ctx.changeSaleChild(itemAttr, itemAttrIndex, item, index),
|
|
128
105
|
key: itemAttr.name
|
|
129
106
|
}, toDisplayString(itemAttr.name), 11, _hoisted_4$2);
|
|
130
107
|
}), 128))
|
|
@@ -298,7 +275,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
298
275
|
var SkuOperate = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
299
276
|
const { componentName, create } = createComponent("sku");
|
|
300
277
|
const _sfc_main = create({
|
|
301
|
-
props:
|
|
278
|
+
props: {
|
|
279
|
+
visible: {
|
|
280
|
+
type: Boolean,
|
|
281
|
+
default: false
|
|
282
|
+
},
|
|
302
283
|
sku: {
|
|
303
284
|
type: Array,
|
|
304
285
|
default: []
|
|
@@ -307,6 +288,10 @@ const _sfc_main = create({
|
|
|
307
288
|
type: Object,
|
|
308
289
|
default: {}
|
|
309
290
|
},
|
|
291
|
+
showSaleLimit: {
|
|
292
|
+
type: Boolean,
|
|
293
|
+
default: false
|
|
294
|
+
},
|
|
310
295
|
stepperMax: {
|
|
311
296
|
type: [Number, String],
|
|
312
297
|
default: 99999
|
|
@@ -315,6 +300,14 @@ const _sfc_main = create({
|
|
|
315
300
|
type: [Number, String],
|
|
316
301
|
default: 1
|
|
317
302
|
},
|
|
303
|
+
purchased: {
|
|
304
|
+
type: [Number, String],
|
|
305
|
+
default: 0
|
|
306
|
+
},
|
|
307
|
+
showSaleLowest: {
|
|
308
|
+
type: Boolean,
|
|
309
|
+
default: false
|
|
310
|
+
},
|
|
318
311
|
btnOptions: {
|
|
319
312
|
type: Array,
|
|
320
313
|
default: () => ["confirm"]
|
|
@@ -323,13 +316,17 @@ const _sfc_main = create({
|
|
|
323
316
|
type: String,
|
|
324
317
|
default: "\u8D2D\u4E70\u6570\u91CF"
|
|
325
318
|
},
|
|
326
|
-
|
|
319
|
+
saleLowestText: {
|
|
327
320
|
type: [Function, Boolean],
|
|
328
321
|
default: false
|
|
329
322
|
},
|
|
330
|
-
|
|
331
|
-
type:
|
|
332
|
-
default:
|
|
323
|
+
saleLimitText: {
|
|
324
|
+
type: [Function, Boolean],
|
|
325
|
+
default: false
|
|
326
|
+
},
|
|
327
|
+
purchasedText: {
|
|
328
|
+
type: [Function, Boolean],
|
|
329
|
+
default: false
|
|
333
330
|
},
|
|
334
331
|
buyText: {
|
|
335
332
|
type: String,
|
|
@@ -343,7 +340,7 @@ const _sfc_main = create({
|
|
|
343
340
|
type: String,
|
|
344
341
|
default: "\u786E\u5B9A"
|
|
345
342
|
}
|
|
346
|
-
}
|
|
343
|
+
},
|
|
347
344
|
emits: [
|
|
348
345
|
"update:visible",
|
|
349
346
|
"selectSku",
|
|
@@ -354,8 +351,7 @@ const _sfc_main = create({
|
|
|
354
351
|
"close",
|
|
355
352
|
"reduce",
|
|
356
353
|
"add",
|
|
357
|
-
"overLimit"
|
|
358
|
-
"clickOverlay"
|
|
354
|
+
"overLimit"
|
|
359
355
|
],
|
|
360
356
|
components: {
|
|
361
357
|
SkuHeader,
|
|
@@ -374,8 +370,6 @@ const _sfc_main = create({
|
|
|
374
370
|
close();
|
|
375
371
|
}
|
|
376
372
|
});
|
|
377
|
-
onMounted(() => {
|
|
378
|
-
});
|
|
379
373
|
const getSlots = (name) => slots[name];
|
|
380
374
|
const selectSku = (skus) => {
|
|
381
375
|
emit("selectSku", skus);
|
|
@@ -444,9 +438,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
444
438
|
onClickCloseIcon: _cache[1] || (_cache[1] = ($event) => _ctx.closePopup("icon")),
|
|
445
439
|
onClickOverlay: _cache[2] || (_cache[2] = ($event) => _ctx.closePopup("overlay")),
|
|
446
440
|
onClose: _cache[3] || (_cache[3] = ($event) => _ctx.closePopup("close")),
|
|
447
|
-
style: { "height": "75%" }
|
|
448
|
-
isWrapTeleport: _ctx.isWrapTeleport,
|
|
449
|
-
teleport: _ctx.teleport
|
|
441
|
+
style: { "height": "75%" }
|
|
450
442
|
}, {
|
|
451
443
|
default: withCtx(() => [
|
|
452
444
|
createElementVNode("view", _hoisted_1, [
|
|
@@ -483,33 +475,32 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
483
475
|
stepperTitle: _ctx.stepperTitle,
|
|
484
476
|
stepperMax: _ctx.stepperMax,
|
|
485
477
|
stepperMin: _ctx.stepperMin,
|
|
486
|
-
|
|
478
|
+
purchased: _ctx.purchased,
|
|
479
|
+
showSaleLimit: _ctx.showSaleLimit,
|
|
480
|
+
showSaleLowest: _ctx.showSaleLowest,
|
|
481
|
+
saleLowestText: _ctx.saleLowestText,
|
|
482
|
+
saleLimitText: _ctx.saleLimitText,
|
|
483
|
+
purchasedText: _ctx.purchasedText,
|
|
487
484
|
onAdd: _ctx.add,
|
|
488
485
|
onReduce: _ctx.reduce,
|
|
489
486
|
onChangeStepper: _ctx.changeStepper,
|
|
490
487
|
onOverLimit: _ctx.stepperOverLimit
|
|
491
|
-
}, null, 8, ["goods", "stepperTitle", "stepperMax", "stepperMin", "
|
|
488
|
+
}, null, 8, ["goods", "stepperTitle", "stepperMax", "stepperMin", "purchased", "showSaleLimit", "showSaleLowest", "saleLowestText", "saleLimitText", "purchasedText", "onAdd", "onReduce", "onChangeStepper", "onOverLimit"])) : createCommentVNode("", true),
|
|
492
489
|
renderSlot(_ctx.$slots, "sku-stepper-bottom")
|
|
493
490
|
]),
|
|
494
|
-
|
|
491
|
+
renderSlot(_ctx.$slots, "sku-operate"),
|
|
492
|
+
!_ctx.getSlots("sku-operate") ? (openBlock(), createBlock(_component_sku_operate, {
|
|
493
|
+
key: 1,
|
|
495
494
|
btnOptions: _ctx.btnOptions,
|
|
496
|
-
btnExtraText: _ctx.btnExtraText,
|
|
497
495
|
buyText: _ctx.buyText,
|
|
498
496
|
addCartText: _ctx.addCartText,
|
|
499
497
|
confirmText: _ctx.confirmText,
|
|
500
498
|
onClickBtnOperate: _ctx.clickBtnOperate
|
|
501
|
-
},
|
|
502
|
-
_ctx.getSlots("sku-operate") ? {
|
|
503
|
-
name: "operate-btn",
|
|
504
|
-
fn: withCtx(() => [
|
|
505
|
-
renderSlot(_ctx.$slots, "sku-operate")
|
|
506
|
-
])
|
|
507
|
-
} : void 0
|
|
508
|
-
]), 1032, ["btnOptions", "btnExtraText", "buyText", "addCartText", "confirmText", "onClickBtnOperate"])
|
|
499
|
+
}, null, 8, ["btnOptions", "buyText", "addCartText", "confirmText", "onClickBtnOperate"])) : createCommentVNode("", true)
|
|
509
500
|
])
|
|
510
501
|
]),
|
|
511
502
|
_: 3
|
|
512
|
-
}, 8, ["visible"
|
|
503
|
+
}, 8, ["visible"]);
|
|
513
504
|
}
|
|
514
|
-
var
|
|
515
|
-
export {
|
|
505
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
506
|
+
export { index_taro as default };
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref, reactive, computed, watch,
|
|
6
|
+
import { ref, reactive, computed, watch, h, unref } from "vue";
|
|
7
|
+
import Taro from "@tarojs/taro";
|
|
7
8
|
import { c as createComponent } from "./component.js";
|
|
8
|
-
import { u as
|
|
9
|
+
import { u as useTaroRect } from "./index.js";
|
|
9
10
|
const { componentName, create } = createComponent("sticky");
|
|
10
11
|
const _sfc_main = create({
|
|
11
12
|
props: {
|
|
@@ -32,6 +33,8 @@ const _sfc_main = create({
|
|
|
32
33
|
emits: ["change", "scroll"],
|
|
33
34
|
setup(props, { emit, slots }) {
|
|
34
35
|
const root = ref();
|
|
36
|
+
const query = Taro.createSelectorQuery();
|
|
37
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
35
38
|
const state = reactive({
|
|
36
39
|
width: 0,
|
|
37
40
|
height: 0,
|
|
@@ -67,19 +70,22 @@ const _sfc_main = create({
|
|
|
67
70
|
const el = unref(elementRef);
|
|
68
71
|
if (!el)
|
|
69
72
|
return false;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
query.select(`#${el.id}`).fields({
|
|
75
|
+
computedStyle: ["display", "position"]
|
|
76
|
+
}, (res) => {
|
|
77
|
+
const hidden = res.display === "none";
|
|
78
|
+
const parentHidden = el.offsetParent === null && res.position !== "fixed";
|
|
79
|
+
resolve(hidden || parentHidden);
|
|
80
|
+
}).exec();
|
|
81
|
+
});
|
|
74
82
|
};
|
|
75
|
-
const isExistRoot = () => {
|
|
76
|
-
|
|
83
|
+
const isExistRoot = async () => {
|
|
84
|
+
const hidden = await isHidden(root);
|
|
85
|
+
if (!root.value || hidden)
|
|
77
86
|
return false;
|
|
78
87
|
return true;
|
|
79
88
|
};
|
|
80
|
-
const getScrollTop = (el) => {
|
|
81
|
-
return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
|
|
82
|
-
};
|
|
83
89
|
const renderFixed = () => {
|
|
84
90
|
var _a;
|
|
85
91
|
return h("view", {
|
|
@@ -87,19 +93,18 @@ const _sfc_main = create({
|
|
|
87
93
|
class: state.fixed ? `${componentName} nut-sticky--fixed` : componentName
|
|
88
94
|
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
89
95
|
};
|
|
90
|
-
const onScroll = () => {
|
|
96
|
+
const onScroll = async (scrollTop) => {
|
|
91
97
|
if (!isExistRoot())
|
|
92
98
|
return;
|
|
93
99
|
const { container, position } = props;
|
|
94
|
-
const
|
|
95
|
-
const rootRect = useRect(root);
|
|
100
|
+
const rootRect = await useTaroRect(root, Taro);
|
|
96
101
|
if (rootRect.width || rootRect.height) {
|
|
97
102
|
state.width = rootRect.width;
|
|
98
103
|
state.height = rootRect.height;
|
|
99
104
|
}
|
|
100
105
|
if (position === "top") {
|
|
101
106
|
if (container) {
|
|
102
|
-
const containerRect =
|
|
107
|
+
const containerRect = await useTaroRect(container, Taro);
|
|
103
108
|
const diff = containerRect.bottom - +offset.value - state.height;
|
|
104
109
|
state.fixed = +offset.value > rootRect.top && containerRect.bottom > 0;
|
|
105
110
|
state.transform = diff < 0 ? diff : 0;
|
|
@@ -107,9 +112,9 @@ const _sfc_main = create({
|
|
|
107
112
|
state.fixed = offset.value > rootRect.top;
|
|
108
113
|
}
|
|
109
114
|
} else if (position === "bottom") {
|
|
110
|
-
const clientHeight =
|
|
115
|
+
const clientHeight = Taro.getSystemInfoSync().windowHeight;
|
|
111
116
|
if (container) {
|
|
112
|
-
const containerRect =
|
|
117
|
+
const containerRect = await useTaroRect(container, Taro);
|
|
113
118
|
const diff = clientHeight - containerRect.top - +offset.value - state.height;
|
|
114
119
|
state.fixed = clientHeight - +offset.value < rootRect.bottom && clientHeight > containerRect.top;
|
|
115
120
|
state.transform = diff < 0 ? -diff : 0;
|
|
@@ -125,16 +130,16 @@ const _sfc_main = create({
|
|
|
125
130
|
watch(() => state.fixed, (val) => {
|
|
126
131
|
emit("change", val);
|
|
127
132
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
onScroll();
|
|
133
|
+
Taro.usePageScroll((res) => {
|
|
134
|
+
onScroll(res.scrollTop);
|
|
131
135
|
});
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
Taro.useReady(() => {
|
|
137
|
+
onScroll(0);
|
|
134
138
|
});
|
|
135
139
|
return () => {
|
|
136
140
|
return h("view", {
|
|
137
141
|
style: rootStyle.value,
|
|
142
|
+
id: `root-${refRandomId}`,
|
|
138
143
|
ref: root
|
|
139
144
|
}, [renderFixed()]);
|
|
140
145
|
};
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -18,13 +18,15 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
25
|
+
import Taro from "@tarojs/taro";
|
|
26
|
+
import { u as useTouch } from "./index3.js";
|
|
27
|
+
import { computed, ref, onMounted, reactive, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot } from "vue";
|
|
27
28
|
import { c as createComponent } from "./component.js";
|
|
29
|
+
import { u as useTaroRect } from "./index.js";
|
|
28
30
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
31
|
const { componentName, create } = createComponent("swipe");
|
|
30
32
|
const _sfc_main = create({
|
|
@@ -48,21 +50,29 @@ const _sfc_main = create({
|
|
|
48
50
|
},
|
|
49
51
|
emits: ["open", "close"],
|
|
50
52
|
setup(props, { emit }) {
|
|
53
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
51
54
|
const classes = computed(() => {
|
|
52
55
|
const prefixCls = componentName;
|
|
53
56
|
return {
|
|
54
57
|
[prefixCls]: true
|
|
55
58
|
};
|
|
56
59
|
});
|
|
57
|
-
const getRefWidth = (ref2) => {
|
|
58
|
-
|
|
59
|
-
return
|
|
60
|
+
const getRefWidth = async (ref2) => {
|
|
61
|
+
let rect = await useTaroRect(ref2, Taro);
|
|
62
|
+
return rect.width || 0;
|
|
60
63
|
};
|
|
61
|
-
const leftRef = ref()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
const leftRef = ref();
|
|
65
|
+
const leftRefWidth = ref(0);
|
|
66
|
+
const rightRef = ref();
|
|
67
|
+
const rightRefWidth = ref(0);
|
|
68
|
+
const initWidth = async () => {
|
|
69
|
+
leftRefWidth.value = await getRefWidth(leftRef);
|
|
70
|
+
rightRefWidth.value = await getRefWidth(rightRef);
|
|
71
|
+
};
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
initWidth();
|
|
75
|
+
}, 100);
|
|
66
76
|
});
|
|
67
77
|
let opened = false;
|
|
68
78
|
let position = "";
|
|
@@ -122,7 +132,7 @@ const _sfc_main = create({
|
|
|
122
132
|
return;
|
|
123
133
|
touch.start(event);
|
|
124
134
|
},
|
|
125
|
-
onTouchMove(event) {
|
|
135
|
+
async onTouchMove(event) {
|
|
126
136
|
if (props.disabled)
|
|
127
137
|
return;
|
|
128
138
|
touch.move(event);
|
|
@@ -168,20 +178,15 @@ const _sfc_main = create({
|
|
|
168
178
|
}, touchMethods), {
|
|
169
179
|
leftRef,
|
|
170
180
|
rightRef,
|
|
181
|
+
refRandomId,
|
|
171
182
|
open,
|
|
172
183
|
close
|
|
173
184
|
});
|
|
174
185
|
}
|
|
175
186
|
});
|
|
176
|
-
const _hoisted_1 =
|
|
177
|
-
class: "nut-swipe__left",
|
|
178
|
-
ref: "leftRef"
|
|
179
|
-
};
|
|
187
|
+
const _hoisted_1 = ["id"];
|
|
180
188
|
const _hoisted_2 = { class: "nut-swipe__content" };
|
|
181
|
-
const _hoisted_3 =
|
|
182
|
-
class: "nut-swipe__right",
|
|
183
|
-
ref: "rightRef"
|
|
184
|
-
};
|
|
189
|
+
const _hoisted_3 = ["id"];
|
|
185
190
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
186
191
|
return openBlock(), createElementBlock("view", {
|
|
187
192
|
class: normalizeClass(_ctx.classes),
|
|
@@ -191,16 +196,24 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
191
196
|
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
192
197
|
onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
193
198
|
}, [
|
|
194
|
-
createElementVNode("view",
|
|
199
|
+
createElementVNode("view", {
|
|
200
|
+
class: "nut-swipe__left",
|
|
201
|
+
ref: "leftRef",
|
|
202
|
+
id: "leftRef-" + _ctx.refRandomId
|
|
203
|
+
}, [
|
|
195
204
|
renderSlot(_ctx.$slots, "left")
|
|
196
|
-
],
|
|
205
|
+
], 8, _hoisted_1),
|
|
197
206
|
createElementVNode("view", _hoisted_2, [
|
|
198
207
|
renderSlot(_ctx.$slots, "default")
|
|
199
208
|
]),
|
|
200
|
-
createElementVNode("view",
|
|
209
|
+
createElementVNode("view", {
|
|
210
|
+
class: "nut-swipe__right",
|
|
211
|
+
ref: "rightRef",
|
|
212
|
+
id: "rightRef-" + _ctx.refRandomId
|
|
213
|
+
}, [
|
|
201
214
|
renderSlot(_ctx.$slots, "right")
|
|
202
|
-
],
|
|
215
|
+
], 8, _hoisted_3)
|
|
203
216
|
], 38);
|
|
204
217
|
}
|
|
205
|
-
var
|
|
206
|
-
export {
|
|
218
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
219
|
+
export { index_taro as default };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive, ref, computed, provide, onMounted,
|
|
6
|
+
import { reactive, ref, computed, provide, onMounted, onActivated, onDeactivated, onBeforeUnmount, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { u as useTaroRect } from "./index.js";
|
|
8
9
|
import { u as useExpose } from "./index2.js";
|
|
10
|
+
import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
|
|
9
11
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
12
|
const DISTANCE = 5;
|
|
11
13
|
function useTouch() {
|
|
@@ -110,6 +112,7 @@ const _sfc_main = create({
|
|
|
110
112
|
emits: ["change"],
|
|
111
113
|
setup(props, { emit, slots }) {
|
|
112
114
|
const container = ref();
|
|
115
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
113
116
|
const state = reactive({
|
|
114
117
|
active: 0,
|
|
115
118
|
num: 0,
|
|
@@ -165,7 +168,7 @@ const _sfc_main = create({
|
|
|
165
168
|
return Math.min(Math.max(num, min), max);
|
|
166
169
|
};
|
|
167
170
|
const requestFrame = (fn) => {
|
|
168
|
-
|
|
171
|
+
requestAnimationFrame.call(null, fn);
|
|
169
172
|
};
|
|
170
173
|
const getOffset = (active, offset = 0) => {
|
|
171
174
|
let currentPosition = active * size.value;
|
|
@@ -277,9 +280,9 @@ const _sfc_main = create({
|
|
|
277
280
|
autoplay();
|
|
278
281
|
}, Number(props.autoPlay));
|
|
279
282
|
};
|
|
280
|
-
const init = (active = +props.initPage) => {
|
|
283
|
+
const init = async (active = +props.initPage) => {
|
|
281
284
|
stopAutoPlay();
|
|
282
|
-
state.rect = container
|
|
285
|
+
state.rect = await useTaroRect(container, Taro);
|
|
283
286
|
active = Math.min(childCount.value - 1, active);
|
|
284
287
|
state.width = props.width ? +props.width : state.rect.width;
|
|
285
288
|
state.height = props.height ? +props.height : state.rect.height;
|
|
@@ -346,14 +349,26 @@ const _sfc_main = create({
|
|
|
346
349
|
to
|
|
347
350
|
});
|
|
348
351
|
onMounted(() => {
|
|
349
|
-
|
|
352
|
+
if (Taro.getEnv() === "WEB") {
|
|
350
353
|
init();
|
|
351
|
-
}
|
|
354
|
+
} else {
|
|
355
|
+
Taro.nextTick(async () => {
|
|
356
|
+
state.rect = await useTaroRect(container, Taro);
|
|
357
|
+
state.rect && init();
|
|
358
|
+
});
|
|
359
|
+
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
360
|
+
init();
|
|
361
|
+
});
|
|
362
|
+
}
|
|
352
363
|
});
|
|
353
364
|
onActivated(() => {
|
|
354
|
-
|
|
365
|
+
if (Taro.getEnv() === "WEB") {
|
|
355
366
|
init();
|
|
356
|
-
}
|
|
367
|
+
} else {
|
|
368
|
+
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
369
|
+
init();
|
|
370
|
+
});
|
|
371
|
+
}
|
|
357
372
|
});
|
|
358
373
|
onDeactivated(() => {
|
|
359
374
|
stopAutoPlay();
|
|
@@ -362,12 +377,12 @@ const _sfc_main = create({
|
|
|
362
377
|
stopAutoPlay();
|
|
363
378
|
});
|
|
364
379
|
watch(() => props.initPage, (val) => {
|
|
365
|
-
|
|
366
|
-
init(
|
|
380
|
+
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
381
|
+
init(+val);
|
|
367
382
|
});
|
|
368
383
|
});
|
|
369
384
|
watch(() => state.children.length, () => {
|
|
370
|
-
|
|
385
|
+
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
371
386
|
init(state.active);
|
|
372
387
|
});
|
|
373
388
|
});
|
|
@@ -376,6 +391,7 @@ const _sfc_main = create({
|
|
|
376
391
|
});
|
|
377
392
|
return {
|
|
378
393
|
state,
|
|
394
|
+
refRandomId,
|
|
379
395
|
classes,
|
|
380
396
|
container,
|
|
381
397
|
componentName,
|
|
@@ -388,9 +404,11 @@ const _sfc_main = create({
|
|
|
388
404
|
};
|
|
389
405
|
}
|
|
390
406
|
});
|
|
407
|
+
const _hoisted_1 = ["id"];
|
|
391
408
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
392
409
|
return openBlock(), createElementBlock("view", {
|
|
393
410
|
ref: "container",
|
|
411
|
+
id: "container-" + _ctx.refRandomId,
|
|
394
412
|
class: normalizeClass(_ctx.classes),
|
|
395
413
|
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
396
414
|
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
@@ -423,7 +441,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
423
441
|
}, null, 4);
|
|
424
442
|
}), 128))
|
|
425
443
|
], 2)) : createCommentVNode("", true)
|
|
426
|
-
],
|
|
444
|
+
], 42, _hoisted_1);
|
|
427
445
|
}
|
|
428
446
|
var Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
429
447
|
export { Swiper as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -116,5 +116,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
116
116
|
])
|
|
117
117
|
], 6);
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
export {
|
|
119
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
120
|
+
export { index_taro as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -73,5 +73,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
73
73
|
renderSlot(_ctx.$slots, "default")
|
|
74
74
|
], 2);
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
export {
|
|
76
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
77
|
+
export { index_taro as default };
|