@nutui/nutui 3.1.10 → 3.1.12-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/CHANGELOG.md +17 -0
- package/dist/nutui.d.ts +5 -1
- package/dist/nutui.es.js +4041 -3518
- package/dist/nutui.umd.js +4084 -3627
- package/dist/packages/_es/ActionSheet.js +13 -12
- package/dist/packages/_es/Address.js +63 -49
- package/dist/packages/_es/Avatar.js +4 -5
- package/dist/packages/_es/BackTop.js +72 -109
- package/dist/packages/_es/Badge.js +4 -5
- package/dist/packages/_es/Barrage.js +63 -57
- package/dist/packages/_es/Button.js +5 -6
- package/dist/packages/_es/Calendar.js +27 -18
- package/dist/packages/_es/Card.js +104 -0
- package/dist/packages/_es/Cell.js +5 -13
- package/dist/packages/_es/CellGroup.js +4 -5
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +9 -4
- package/dist/packages/_es/CircleProgress.js +142 -46
- package/dist/packages/_es/Col.js +4 -5
- package/dist/packages/_es/Collapse.js +35 -10
- package/dist/packages/_es/CollapseItem.js +80 -35
- package/dist/packages/_es/CountDown.js +7 -5
- package/dist/packages/_es/CountUp.js +34 -31
- package/dist/packages/_es/DatePicker.js +451 -219
- package/dist/packages/_es/Dialog.js +13 -87
- package/dist/packages/_es/Divider.js +5 -6
- package/dist/packages/_es/Drag.js +76 -50
- package/dist/packages/_es/Elevator.js +81 -52
- package/dist/packages/_es/FixedNav.js +8 -9
- package/dist/packages/_es/Form.js +137 -0
- package/dist/packages/_es/FormItem.js +109 -0
- package/dist/packages/_es/Icon.js +6 -40
- package/dist/packages/_es/ImagePreview.js +23 -21
- package/dist/packages/_es/InfiniteLoading.js +95 -109
- package/dist/packages/_es/Input.js +22 -21
- package/dist/packages/_es/InputNumber.js +24 -18
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +89 -171
- package/dist/packages/_es/MenuItem.js +155 -18
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +39 -26
- package/dist/packages/_es/Notify.js +30 -166
- package/dist/packages/_es/NumberKeyboard.js +10 -6
- package/dist/packages/_es/OverLay.js +22 -29
- package/dist/packages/_es/Pagination.js +8 -9
- package/dist/packages/_es/Picker.js +61 -447
- package/dist/packages/_es/Popover.js +146 -25
- package/dist/packages/_es/Popup.js +18 -39
- package/dist/packages/_es/Price.js +18 -7
- package/dist/packages/_es/Progress.js +23 -12
- package/dist/packages/_es/Radio.js +20 -7
- package/dist/packages/_es/RadioGroup.js +7 -3
- package/dist/packages/_es/Range.js +38 -59
- package/dist/packages/_es/Rate.js +16 -20
- package/dist/packages/_es/Row.js +4 -5
- package/dist/packages/_es/SearchBar.js +7 -5
- package/dist/packages/_es/ShortPassword.js +89 -59
- package/dist/packages/_es/Signature.js +70 -71
- package/dist/packages/_es/Sku.js +508 -0
- package/dist/packages/_es/Step.js +10 -8
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +42 -27
- package/dist/packages/_es/Swiper.js +17 -418
- package/dist/packages/_es/SwiperItem.js +14 -39
- package/dist/packages/_es/Switch.js +4 -5
- package/dist/packages/_es/TabPane.js +4 -5
- package/dist/packages/_es/Tabbar.js +4 -5
- package/dist/packages/_es/TabbarItem.js +8 -9
- package/dist/packages/_es/Tabs.js +23 -17
- package/dist/packages/_es/Tag.js +5 -6
- package/dist/packages/_es/TextArea.js +16 -12
- package/dist/packages/_es/TimeDetail.js +7 -5
- package/dist/packages/_es/TimePannel.js +7 -5
- package/dist/packages/_es/TimeSelect.js +12 -7
- package/dist/packages/_es/Toast.js +41 -163
- package/dist/packages/_es/Uploader.js +210 -164
- package/dist/packages/_es/commonProps.js +30 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
- package/dist/packages/_es/index2.js +44 -8
- package/dist/packages/_es/index3.js +419 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +9 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +60 -0
- package/dist/packages/menu/index.scss +32 -60
- package/dist/packages/menuitem/index.scss +36 -99
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/progress/index.scss +2 -0
- package/dist/packages/radio/index.scss +32 -4
- package/dist/packages/radiogroup/index.scss +20 -0
- package/dist/packages/sku/index.scss +147 -0
- package/dist/packages/switch/index.scss +1 -1
- package/dist/packages/uploader/index.scss +95 -8
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -2
- package/dist/styles/mixins/index.scss +0 -4
- package/dist/styles/themes/default.scss +34 -30
- package/dist/styles/variables.scss +45 -3
- package/package.json +3 -2
- package/dist/packages/_es/Video.js +0 -405
- package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
- package/dist/packages/_es/style.css +0 -160
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { i as isPromise } from "./util.js";
|
|
8
|
+
import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, renderSlot } from "vue";
|
|
9
|
+
const component = {
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: {}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
components: {},
|
|
17
|
+
emits: ["validate"],
|
|
18
|
+
setup(props, { emit, slots }) {
|
|
19
|
+
const formErrorTip = computed(() => reactive({}));
|
|
20
|
+
provide("formErrorTip", formErrorTip);
|
|
21
|
+
const init = (value = props.modelValue) => {
|
|
22
|
+
Object.keys(value).forEach((item) => {
|
|
23
|
+
formErrorTip.value[item] = "";
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const reset = () => {
|
|
27
|
+
init();
|
|
28
|
+
};
|
|
29
|
+
watch(() => props.modelValue, (value) => {
|
|
30
|
+
init(value);
|
|
31
|
+
}, { immediate: true });
|
|
32
|
+
const findFormItem = (vnodes) => {
|
|
33
|
+
let task = [];
|
|
34
|
+
vnodes.forEach((vnode, index) => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
let type = vnode.type;
|
|
37
|
+
type = type.name || type;
|
|
38
|
+
if (type == "nut-form-item") {
|
|
39
|
+
task.push({
|
|
40
|
+
prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
|
|
41
|
+
rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return task;
|
|
46
|
+
};
|
|
47
|
+
const tipMessage = (errorMsg) => {
|
|
48
|
+
if (errorMsg.message) {
|
|
49
|
+
emit("validate", errorMsg);
|
|
50
|
+
}
|
|
51
|
+
formErrorTip.value[errorMsg.prop] = errorMsg.message;
|
|
52
|
+
};
|
|
53
|
+
const checkRule = (item) => {
|
|
54
|
+
const { rules, prop } = item;
|
|
55
|
+
const _Promise = (errorMsg) => {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
tipMessage(errorMsg);
|
|
58
|
+
resolve(errorMsg);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const value = props.modelValue[prop];
|
|
62
|
+
tipMessage({ prop, message: "" });
|
|
63
|
+
while (rules.length) {
|
|
64
|
+
const { required, validator, regex, message } = rules.shift();
|
|
65
|
+
const errorMsg = { prop, message };
|
|
66
|
+
if (required) {
|
|
67
|
+
if (!value) {
|
|
68
|
+
return _Promise(errorMsg);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (regex && !regex.test(String(value))) {
|
|
72
|
+
return _Promise(errorMsg);
|
|
73
|
+
}
|
|
74
|
+
if (validator) {
|
|
75
|
+
const result = validator(value);
|
|
76
|
+
if (isPromise(result)) {
|
|
77
|
+
return new Promise((r, j) => {
|
|
78
|
+
result.then((res) => {
|
|
79
|
+
if (!res) {
|
|
80
|
+
tipMessage(errorMsg);
|
|
81
|
+
r(errorMsg);
|
|
82
|
+
} else {
|
|
83
|
+
r(true);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
if (!result) {
|
|
89
|
+
return _Promise(errorMsg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return Promise.resolve(true);
|
|
95
|
+
};
|
|
96
|
+
const validate = () => {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
let task = findFormItem(slots.default());
|
|
99
|
+
let errors = task.map((item) => {
|
|
100
|
+
return checkRule(item);
|
|
101
|
+
});
|
|
102
|
+
Promise.all(errors).then((errorRes) => {
|
|
103
|
+
errorRes = errorRes.filter((item) => item != true);
|
|
104
|
+
const res = { valid: true, errors: [] };
|
|
105
|
+
if (errorRes.length) {
|
|
106
|
+
res.valid = false;
|
|
107
|
+
res.errors = errorRes;
|
|
108
|
+
}
|
|
109
|
+
resolve(res);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const onSubmit = () => {
|
|
114
|
+
validate();
|
|
115
|
+
return false;
|
|
116
|
+
};
|
|
117
|
+
return { validate, reset, onSubmit, formErrorTip };
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const { create } = createComponent("form");
|
|
121
|
+
var _sfc_main = create(component);
|
|
122
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
123
|
+
const _component_nut_cell_group = resolveComponent("nut-cell-group");
|
|
124
|
+
return openBlock(), createElementBlock("form", {
|
|
125
|
+
class: "nut-form",
|
|
126
|
+
onSubmit: _cache[0] || (_cache[0] = (...args) => _ctx.onSubmit && _ctx.onSubmit(...args))
|
|
127
|
+
}, [
|
|
128
|
+
createVNode(_component_nut_cell_group, null, {
|
|
129
|
+
default: withCtx(() => [
|
|
130
|
+
renderSlot(_ctx.$slots, "default")
|
|
131
|
+
]),
|
|
132
|
+
_: 3
|
|
133
|
+
})
|
|
134
|
+
], 32);
|
|
135
|
+
}
|
|
136
|
+
_sfc_main.render = _sfc_render;
|
|
137
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
7
|
+
import { inject, computed, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from "vue";
|
|
8
|
+
import { c as createComponent } from "./component.js";
|
|
9
|
+
const { componentName, create } = createComponent("form-item");
|
|
10
|
+
var _sfc_main = create({
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
prop: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
label: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
required: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
showErrorMessage: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
34
|
+
},
|
|
35
|
+
showErrorLine: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true
|
|
38
|
+
},
|
|
39
|
+
labelWidth: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
labelAlign: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "left"
|
|
46
|
+
},
|
|
47
|
+
errorMessageAlign: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "left"
|
|
50
|
+
},
|
|
51
|
+
bodyAlign: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "left"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
components: {},
|
|
57
|
+
emits: [""],
|
|
58
|
+
setup(props, { emit }) {
|
|
59
|
+
const parent = inject("formErrorTip");
|
|
60
|
+
const labelStyle = computed(() => {
|
|
61
|
+
return {
|
|
62
|
+
width: pxCheck(props.labelWidth),
|
|
63
|
+
textAlign: props.labelAlign
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
const bodyStyle = computed(() => {
|
|
67
|
+
return {
|
|
68
|
+
textAlign: props.bodyAlign
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
const errorMessageStyle = computed(() => {
|
|
72
|
+
return {
|
|
73
|
+
textAlign: props.errorMessageAlign
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return { parent, labelStyle, bodyStyle, errorMessageStyle };
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
|
|
80
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
81
|
+
const _component_nut_cell = resolveComponent("nut-cell");
|
|
82
|
+
return openBlock(), createBlock(_component_nut_cell, {
|
|
83
|
+
class: normalizeClass(["nut-form-item", { error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }])
|
|
84
|
+
}, {
|
|
85
|
+
default: withCtx(() => [
|
|
86
|
+
_ctx.label ? (openBlock(), createElementBlock("view", {
|
|
87
|
+
key: 0,
|
|
88
|
+
class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
|
|
89
|
+
style: normalizeStyle(_ctx.labelStyle)
|
|
90
|
+
}, toDisplayString(_ctx.label), 7)) : createCommentVNode("", true),
|
|
91
|
+
createElementVNode("view", _hoisted_1, [
|
|
92
|
+
createElementVNode("view", {
|
|
93
|
+
class: "nut-form-item__body__slots",
|
|
94
|
+
style: normalizeStyle(_ctx.bodyStyle)
|
|
95
|
+
}, [
|
|
96
|
+
renderSlot(_ctx.$slots, "default")
|
|
97
|
+
], 4),
|
|
98
|
+
_ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: "nut-form-item__body__tips",
|
|
101
|
+
style: normalizeStyle(_ctx.errorMessageStyle)
|
|
102
|
+
}, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
|
|
103
|
+
])
|
|
104
|
+
]),
|
|
105
|
+
_: 3
|
|
106
|
+
}, 8, ["class"]);
|
|
107
|
+
}
|
|
108
|
+
_sfc_main.render = _sfc_render;
|
|
109
|
+
export { _sfc_main as default };
|
|
@@ -1,44 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
props: {
|
|
12
|
-
name: { type: String, default: "" },
|
|
13
|
-
size: { type: [String, Number], default: "" },
|
|
14
|
-
classPrefix: { type: String, default: "nut-icon" },
|
|
15
|
-
fontClassName: { type: String, default: "nutui-iconfont" },
|
|
16
|
-
color: { type: String, default: "" },
|
|
17
|
-
tag: { type: String, default: "i" }
|
|
18
|
-
},
|
|
19
|
-
emits: ["click"],
|
|
20
|
-
setup(props, { emit, slots }) {
|
|
21
|
-
const handleClick = (event) => {
|
|
22
|
-
emit("click", event);
|
|
23
|
-
};
|
|
24
|
-
const isImage = () => {
|
|
25
|
-
return props.name ? props.name.indexOf("/") !== -1 : false;
|
|
26
|
-
};
|
|
27
|
-
return () => {
|
|
28
|
-
var _a;
|
|
29
|
-
const _isImage = isImage();
|
|
30
|
-
return h(_isImage ? "img" : props.tag, {
|
|
31
|
-
class: _isImage ? `${componentName}__img` : `${props.fontClassName} ${componentName} ${props.classPrefix}-${props.name}`,
|
|
32
|
-
style: {
|
|
33
|
-
color: props.color,
|
|
34
|
-
fontSize: pxCheck(props.size),
|
|
35
|
-
width: pxCheck(props.size),
|
|
36
|
-
height: pxCheck(props.size)
|
|
37
|
-
},
|
|
38
|
-
onClick: handleClick,
|
|
39
|
-
src: _isImage ? props.name : ""
|
|
40
|
-
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
export { _sfc_main as default };
|
|
6
|
+
import { _ as _sfc_main } from "./index.taro.vue_vue&type=script&lang.js";
|
|
7
|
+
export { _ as default } from "./index.taro.vue_vue&type=script&lang.js";
|
|
8
|
+
import "vue";
|
|
9
|
+
import "./component.js";
|
|
10
|
+
import "./pxCheck.js";
|
|
@@ -17,20 +17,23 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
21
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
22
|
+
};
|
|
20
23
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
24
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
22
25
|
* (c) 2021 @jdf2e.
|
|
23
26
|
* Released under the MIT License.
|
|
24
27
|
*/
|
|
25
28
|
import { toRefs, reactive, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createBlock, Fragment, renderList, createElementVNode, createCommentVNode, toDisplayString } from "vue";
|
|
26
29
|
import { c as createComponent } from "./component.js";
|
|
27
|
-
import
|
|
28
|
-
import
|
|
30
|
+
import _sfc_main$1 from "./Popup.js";
|
|
31
|
+
import "./use-lock-scroll.js";
|
|
29
32
|
import "./OverLay.js";
|
|
30
|
-
import "./
|
|
33
|
+
import "./index.taro.vue_vue&type=script&lang.js";
|
|
31
34
|
import "./pxCheck.js";
|
|
32
35
|
const { componentName, create } = createComponent("imagepreview");
|
|
33
|
-
|
|
36
|
+
var _sfc_main = create({
|
|
34
37
|
props: {
|
|
35
38
|
show: {
|
|
36
39
|
type: Boolean,
|
|
@@ -42,16 +45,16 @@ const _sfc_main = create({
|
|
|
42
45
|
}
|
|
43
46
|
},
|
|
44
47
|
components: {
|
|
45
|
-
[
|
|
48
|
+
[_sfc_main$1.name]: _sfc_main$1
|
|
46
49
|
},
|
|
47
50
|
setup(props, { emit }) {
|
|
48
|
-
const {
|
|
51
|
+
const { value, images } = toRefs(props);
|
|
49
52
|
const state = reactive({
|
|
50
|
-
showPop:
|
|
53
|
+
showPop: value,
|
|
51
54
|
active: 1
|
|
52
55
|
});
|
|
53
56
|
const slideChangeEnd = function(page) {
|
|
54
|
-
state.active = page + 1;
|
|
57
|
+
state.active = page.detail.current + 1;
|
|
55
58
|
};
|
|
56
59
|
const closePop = function() {
|
|
57
60
|
state.showPop = false;
|
|
@@ -71,8 +74,8 @@ const _hoisted_1 = { class: "nut-imagepreview" };
|
|
|
71
74
|
const _hoisted_2 = ["src"];
|
|
72
75
|
const _hoisted_3 = { class: "nut-imagepreview-index" };
|
|
73
76
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
77
|
+
const _component_swiper_item = resolveComponent("swiper-item");
|
|
78
|
+
const _component_swiper = resolveComponent("swiper");
|
|
76
79
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
77
80
|
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
78
81
|
createVNode(_component_nut_popup, {
|
|
@@ -82,18 +85,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
82
85
|
onClick: _ctx.closePop
|
|
83
86
|
}, {
|
|
84
87
|
default: withCtx(() => [
|
|
85
|
-
_ctx.showPop ? (openBlock(), createBlock(
|
|
88
|
+
_ctx.showPop ? (openBlock(), createBlock(_component_swiper, {
|
|
86
89
|
key: 0,
|
|
87
|
-
|
|
90
|
+
autoplay: true,
|
|
91
|
+
interval: 3e3,
|
|
88
92
|
class: "nut-imagepreview-swiper",
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onChange: _ctx.slideChangeEnd,
|
|
92
|
-
"is-preventDefault": false
|
|
93
|
+
circular: true,
|
|
94
|
+
onChange: _ctx.slideChangeEnd
|
|
93
95
|
}, {
|
|
94
96
|
default: withCtx(() => [
|
|
95
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item,
|
|
96
|
-
return openBlock(), createBlock(
|
|
97
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item, index) => {
|
|
98
|
+
return openBlock(), createBlock(_component_swiper_item, { key: index }, {
|
|
97
99
|
default: withCtx(() => [
|
|
98
100
|
createElementVNode("img", {
|
|
99
101
|
src: item.imgSrc,
|
|
@@ -112,5 +114,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
112
114
|
}, 8, ["visible", "onClick"])
|
|
113
115
|
]);
|
|
114
116
|
}
|
|
115
|
-
|
|
116
|
-
export {
|
|
117
|
+
_sfc_main.render = _sfc_render;
|
|
118
|
+
export { _sfc_main as default };
|
|
@@ -17,16 +17,21 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
21
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
22
|
+
};
|
|
20
23
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
24
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
22
25
|
* (c) 2021 @jdf2e.
|
|
23
26
|
* Released under the MIT License.
|
|
24
27
|
*/
|
|
25
|
-
import { reactive, computed, onMounted,
|
|
28
|
+
import { reactive, computed, onMounted, toRefs, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, normalizeStyle, createVNode, toDisplayString, renderSlot, createElementBlock, createCommentVNode } from "vue";
|
|
26
29
|
import { c as createComponent } from "./component.js";
|
|
27
|
-
import { _ as
|
|
30
|
+
import { _ as _sfc_main$1 } from "./index.taro.vue_vue&type=script&lang.js";
|
|
31
|
+
import Taro from "@tarojs/taro";
|
|
32
|
+
import "./pxCheck.js";
|
|
28
33
|
const { componentName, create } = createComponent("infiniteloading");
|
|
29
|
-
|
|
34
|
+
var _sfc_main = create({
|
|
30
35
|
props: {
|
|
31
36
|
hasMore: {
|
|
32
37
|
type: Boolean,
|
|
@@ -74,14 +79,16 @@ const _sfc_main = create({
|
|
|
74
79
|
}
|
|
75
80
|
},
|
|
76
81
|
emits: ["scroll-change", "load-more", "refresh"],
|
|
82
|
+
components: {
|
|
83
|
+
"nut-icon": _sfc_main$1
|
|
84
|
+
},
|
|
77
85
|
setup(props, { emit, slots }) {
|
|
78
86
|
const state = reactive({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
refreshTop: null,
|
|
82
|
-
beforeScrollTop: 0,
|
|
83
|
-
isTouching: false,
|
|
87
|
+
scrollHeight: 0,
|
|
88
|
+
scrollTop: 0,
|
|
84
89
|
isInfiniting: false,
|
|
90
|
+
direction: "down",
|
|
91
|
+
isTouching: false,
|
|
85
92
|
refreshMaxH: 0,
|
|
86
93
|
y: 0,
|
|
87
94
|
x: 0,
|
|
@@ -100,69 +107,46 @@ const _sfc_main = create({
|
|
|
100
107
|
};
|
|
101
108
|
});
|
|
102
109
|
const getParentElement = (el) => {
|
|
103
|
-
return !!props.containerId ?
|
|
104
|
-
};
|
|
105
|
-
const requestAniFrame = () => {
|
|
106
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
|
|
107
|
-
window.setTimeout(callback, 1e3 / 60);
|
|
108
|
-
};
|
|
110
|
+
return Taro.createSelectorQuery().select(!!props.containerId ? `#${props.containerId} #${el}` : `#${el}`);
|
|
109
111
|
};
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
+
const getScrollHeight = () => {
|
|
113
|
+
const parentElement = getParentElement("scroller");
|
|
114
|
+
parentElement.boundingClientRect((rect) => {
|
|
115
|
+
state.scrollHeight = rect.height;
|
|
116
|
+
}).exec();
|
|
112
117
|
};
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const isScrollAtBottom = () => {
|
|
117
|
-
let offsetDistance = 0;
|
|
118
|
-
let resScrollTop = 0;
|
|
119
|
-
let direction = "down";
|
|
120
|
-
const windowScrollTop = getWindowScrollTop();
|
|
121
|
-
if (props.useWindow) {
|
|
122
|
-
if (state.scroller) {
|
|
123
|
-
offsetDistance = calculateTopPosition(state.scroller) + state.scroller.offsetHeight - windowScrollTop - window.innerHeight;
|
|
124
|
-
}
|
|
125
|
-
resScrollTop = windowScrollTop;
|
|
118
|
+
const lower = () => {
|
|
119
|
+
if (state.direction == "up" || !props.hasMore || state.isInfiniting) {
|
|
120
|
+
return false;
|
|
126
121
|
} else {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
state.isInfiniting = true;
|
|
123
|
+
emit("load-more", infiniteDone);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const scroll = (e) => {
|
|
127
|
+
if (e.detail.scrollTop <= 0) {
|
|
128
|
+
e.detail.scrollTop = 0;
|
|
129
|
+
} else if (e.detail.scrollTop >= state.scrollHeight) {
|
|
130
|
+
e.detail.scrollTop = state.scrollHeight;
|
|
130
131
|
}
|
|
131
|
-
if (
|
|
132
|
-
direction = "
|
|
132
|
+
if (e.detail.scrollTop > state.scrollTop || e.detail.scrollTop >= state.scrollHeight) {
|
|
133
|
+
state.direction = "down";
|
|
133
134
|
} else {
|
|
134
|
-
direction = "
|
|
135
|
+
state.direction = "up";
|
|
135
136
|
}
|
|
136
|
-
state.
|
|
137
|
-
emit("scroll-change",
|
|
138
|
-
return offsetDistance <= props.threshold && direction == "down";
|
|
137
|
+
state.scrollTop = e.detail.scrollTop;
|
|
138
|
+
emit("scroll-change", e.detail.scrollTop);
|
|
139
139
|
};
|
|
140
140
|
const infiniteDone = () => {
|
|
141
141
|
state.isInfiniting = false;
|
|
142
142
|
};
|
|
143
|
-
const handleScroll = () => {
|
|
144
|
-
requestAniFrame()(() => {
|
|
145
|
-
if (!isScrollAtBottom() || !props.hasMore || state.isInfiniting) {
|
|
146
|
-
return false;
|
|
147
|
-
} else {
|
|
148
|
-
state.isInfiniting = true;
|
|
149
|
-
emit("load-more", infiniteDone);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const scrollListener = () => {
|
|
154
|
-
state.scrollEl.addEventListener("scroll", handleScroll, props.useCapture);
|
|
155
|
-
};
|
|
156
|
-
const refreshDone = () => {
|
|
157
|
-
state.distance = 0;
|
|
158
|
-
state.isTouching = false;
|
|
159
|
-
};
|
|
160
143
|
const touchStart = (event) => {
|
|
161
|
-
if (state.
|
|
144
|
+
if (state.scrollTop == 0 && !state.isTouching && props.isOpenRefresh) {
|
|
162
145
|
state.y = event.touches[0].pageY;
|
|
163
146
|
state.isTouching = true;
|
|
164
|
-
|
|
165
|
-
|
|
147
|
+
getParentElement("refreshTop").boundingClientRect((rect) => {
|
|
148
|
+
state.refreshMaxH = Math.floor(rect.height * 1 + 10);
|
|
149
|
+
}).exec();
|
|
166
150
|
}
|
|
167
151
|
};
|
|
168
152
|
const touchMove = (event) => {
|
|
@@ -183,28 +167,20 @@ const _sfc_main = create({
|
|
|
183
167
|
emit("refresh", refreshDone);
|
|
184
168
|
}
|
|
185
169
|
};
|
|
170
|
+
const refreshDone = () => {
|
|
171
|
+
state.distance = 0;
|
|
172
|
+
state.isTouching = false;
|
|
173
|
+
};
|
|
186
174
|
onMounted(() => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
onUnmounted(() => {
|
|
192
|
-
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
193
|
-
});
|
|
194
|
-
const isKeepAlive = ref(false);
|
|
195
|
-
onActivated(() => {
|
|
196
|
-
if (isKeepAlive.value) {
|
|
197
|
-
isKeepAlive.value = false;
|
|
198
|
-
scrollListener();
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
onDeactivated(() => {
|
|
202
|
-
isKeepAlive.value = true;
|
|
203
|
-
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
getScrollHeight();
|
|
177
|
+
}, 200);
|
|
204
178
|
});
|
|
205
179
|
return __spreadProps(__spreadValues({
|
|
206
180
|
classes
|
|
207
181
|
}, toRefs(state)), {
|
|
182
|
+
lower,
|
|
183
|
+
scroll,
|
|
208
184
|
touchStart,
|
|
209
185
|
touchMove,
|
|
210
186
|
touchEnd,
|
|
@@ -212,7 +188,10 @@ const _sfc_main = create({
|
|
|
212
188
|
});
|
|
213
189
|
}
|
|
214
190
|
});
|
|
215
|
-
const _hoisted_1 = {
|
|
191
|
+
const _hoisted_1 = {
|
|
192
|
+
class: "top-box",
|
|
193
|
+
id: "refreshTop"
|
|
194
|
+
};
|
|
216
195
|
const _hoisted_2 = { class: "top-text" };
|
|
217
196
|
const _hoisted_3 = { class: "nut-infinite-container" };
|
|
218
197
|
const _hoisted_4 = { class: "nut-infinite-bottom" };
|
|
@@ -227,39 +206,46 @@ const _hoisted_7 = {
|
|
|
227
206
|
};
|
|
228
207
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
229
208
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
230
|
-
|
|
209
|
+
const _component_scroll_view = resolveComponent("scroll-view");
|
|
210
|
+
return openBlock(), createBlock(_component_scroll_view, {
|
|
231
211
|
class: normalizeClass(_ctx.classes),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
createElementVNode("view",
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
212
|
+
scrollY: "true",
|
|
213
|
+
style: { "height": "100%" },
|
|
214
|
+
id: "scroller",
|
|
215
|
+
onScrolltolower: _ctx.lower,
|
|
216
|
+
onScroll: _ctx.scroll,
|
|
217
|
+
onTouchstart: _ctx.touchStart,
|
|
218
|
+
onTouchmove: _ctx.touchMove,
|
|
219
|
+
onTouchend: _ctx.touchEnd
|
|
220
|
+
}, {
|
|
221
|
+
default: withCtx(() => [
|
|
222
|
+
createElementVNode("view", {
|
|
223
|
+
class: "nut-infinite-top",
|
|
224
|
+
style: normalizeStyle(_ctx.getStyle)
|
|
225
|
+
}, [
|
|
226
|
+
createElementVNode("view", _hoisted_1, [
|
|
227
|
+
createVNode(_component_nut_icon, {
|
|
228
|
+
class: "top-img",
|
|
229
|
+
name: _ctx.pullIcon
|
|
230
|
+
}, null, 8, ["name"]),
|
|
231
|
+
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.pullTxt), 1)
|
|
232
|
+
])
|
|
233
|
+
], 4),
|
|
234
|
+
createElementVNode("view", _hoisted_3, [
|
|
235
|
+
renderSlot(_ctx.$slots, "default")
|
|
236
|
+
]),
|
|
237
|
+
createElementVNode("view", _hoisted_4, [
|
|
238
|
+
_ctx.isInfiniting ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
239
|
+
createVNode(_component_nut_icon, {
|
|
240
|
+
class: "bottom-img",
|
|
241
|
+
name: _ctx.loadIcon
|
|
242
|
+
}, null, 8, ["name"]),
|
|
243
|
+
createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt), 1)
|
|
244
|
+
])) : !_ctx.hasMore ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt), 1)) : createCommentVNode("", true)
|
|
248
245
|
])
|
|
249
|
-
], 4),
|
|
250
|
-
createElementVNode("view", _hoisted_3, [
|
|
251
|
-
renderSlot(_ctx.$slots, "default")
|
|
252
246
|
]),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
createVNode(_component_nut_icon, {
|
|
256
|
-
class: "bottom-img",
|
|
257
|
-
name: _ctx.loadIcon
|
|
258
|
-
}, null, 8, ["name"]),
|
|
259
|
-
createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt), 1)
|
|
260
|
-
])) : !_ctx.hasMore ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt), 1)) : createCommentVNode("", true)
|
|
261
|
-
])
|
|
262
|
-
], 34);
|
|
247
|
+
_: 3
|
|
248
|
+
}, 8, ["class", "onScrolltolower", "onScroll", "onTouchstart", "onTouchmove", "onTouchend"]);
|
|
263
249
|
}
|
|
264
|
-
|
|
265
|
-
export {
|
|
250
|
+
_sfc_main.render = _sfc_render;
|
|
251
|
+
export { _sfc_main as default };
|