@nutui/nutui 3.1.22-beta.5 → 3.1.23-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 +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +20412 -4214
- package/dist/nutui.umd.js +20518 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +454 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/packages/picker/index.scss +13 -0
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +4 -1
- package/dist/styles/variables-jdt.scss +4 -1
- package/dist/styles/variables.scss +1 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
- package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,20 +1,67 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { toRefs
|
|
7
|
-
import { c } from "./component.js";
|
|
8
|
-
import { _ as
|
|
6
|
+
import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { componentName
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
const { componentName, create } = createComponent("indicator");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
size: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 3,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
current: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 1,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
block: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
align: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "center"
|
|
30
|
+
},
|
|
31
|
+
fillZero: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(props) {
|
|
37
|
+
const { block, align } = toRefs(props);
|
|
38
|
+
const classes = computed(() => {
|
|
39
|
+
const prefixCls = componentName;
|
|
40
|
+
return {
|
|
41
|
+
[prefixCls]: true,
|
|
42
|
+
[`${prefixCls}--block`]: block.value,
|
|
43
|
+
[`${prefixCls}--align__${align.value}`]: block.value && align.value
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
return { classes, componentName };
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
50
|
+
return openBlock(), createElementBlock("view", {
|
|
51
|
+
class: normalizeClass(_ctx.classes)
|
|
52
|
+
}, [
|
|
53
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.size, (item) => {
|
|
54
|
+
return openBlock(), createElementBlock(Fragment, { key: item }, [
|
|
55
|
+
item === _ctx.current ? (openBlock(), createElementBlock("view", {
|
|
56
|
+
key: 0,
|
|
57
|
+
class: normalizeClass(`${_ctx.componentName}--number`)
|
|
58
|
+
}, toDisplayString(_ctx.fillZero && item < 10 ? `0${item}` : item), 3)) : (openBlock(), createElementBlock("view", {
|
|
59
|
+
key: 1,
|
|
60
|
+
class: normalizeClass(`${_ctx.componentName}--dot`)
|
|
61
|
+
}, null, 2))
|
|
62
|
+
], 64);
|
|
63
|
+
}), 128))
|
|
64
|
+
], 2);
|
|
65
|
+
}
|
|
66
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
67
|
+
export { index as default };
|
|
@@ -1,64 +1,256 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { reactive, computed, onMounted, onUnmounted, ref, onActivated, onDeactivated, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createVNode, toDisplayString, renderSlot, Fragment, createCommentVNode } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { componentName
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const { componentName, create, translate } = createComponent("infiniteloading");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
hasMore: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
threshold: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 200
|
|
20
|
+
},
|
|
21
|
+
pullIcon: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png"
|
|
24
|
+
},
|
|
25
|
+
pullTxt: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
loadIcon: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png"
|
|
32
|
+
},
|
|
33
|
+
loadTxt: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
37
|
+
loadMoreTxt: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
useWindow: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
containerId: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ""
|
|
48
|
+
},
|
|
49
|
+
useCapture: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
isOpenRefresh: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
19
56
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
},
|
|
58
|
+
emits: ["scroll-change", "load-more", "refresh"],
|
|
59
|
+
setup(props, { emit, slots }) {
|
|
60
|
+
const state = reactive({
|
|
61
|
+
scrollEl: window,
|
|
62
|
+
scroller: null,
|
|
63
|
+
refreshTop: null,
|
|
64
|
+
beforeScrollTop: 0,
|
|
65
|
+
isTouching: false,
|
|
66
|
+
isInfiniting: false,
|
|
67
|
+
refreshMaxH: 0,
|
|
68
|
+
y: 0,
|
|
69
|
+
x: 0,
|
|
70
|
+
distance: 0
|
|
30
71
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
const classes = computed(() => {
|
|
73
|
+
const prefixCls = componentName;
|
|
74
|
+
return {
|
|
75
|
+
[prefixCls]: true
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
const getStyle = computed(() => {
|
|
79
|
+
return {
|
|
80
|
+
height: state.distance < 0 ? `0px` : `${state.distance}px`,
|
|
81
|
+
transition: state.isTouching ? `height 0s cubic-bezier(0.25,0.1,0.25,1)` : `height 0.2s cubic-bezier(0.25,0.1,0.25,1)`
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
const requestAniFrame = () => {
|
|
85
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
|
|
86
|
+
window.setTimeout(callback, 1e3 / 60);
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const getWindowScrollTop = () => {
|
|
90
|
+
return window.pageYOffset !== void 0 ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
|
|
91
|
+
};
|
|
92
|
+
const calculateTopPosition = (el) => {
|
|
93
|
+
return !el ? 0 : el.offsetTop + calculateTopPosition(el.offsetParent);
|
|
94
|
+
};
|
|
95
|
+
const isScrollAtBottom = () => {
|
|
96
|
+
let offsetDistance = 0;
|
|
97
|
+
let resScrollTop = 0;
|
|
98
|
+
let direction = "down";
|
|
99
|
+
const windowScrollTop = getWindowScrollTop();
|
|
100
|
+
if (props.useWindow) {
|
|
101
|
+
if (state.scroller) {
|
|
102
|
+
offsetDistance = calculateTopPosition(state.scroller) + state.scroller.offsetHeight - windowScrollTop - window.innerHeight;
|
|
103
|
+
}
|
|
104
|
+
resScrollTop = windowScrollTop;
|
|
105
|
+
} else {
|
|
106
|
+
const { scrollHeight, clientHeight, scrollTop } = state.scrollEl;
|
|
107
|
+
offsetDistance = scrollHeight - clientHeight - scrollTop;
|
|
108
|
+
resScrollTop = scrollTop;
|
|
109
|
+
}
|
|
110
|
+
if (state.beforeScrollTop > resScrollTop) {
|
|
111
|
+
direction = "up";
|
|
112
|
+
} else {
|
|
113
|
+
direction = "down";
|
|
114
|
+
}
|
|
115
|
+
state.beforeScrollTop = resScrollTop;
|
|
116
|
+
emit("scroll-change", resScrollTop);
|
|
117
|
+
return offsetDistance <= props.threshold && direction == "down";
|
|
118
|
+
};
|
|
119
|
+
const infiniteDone = () => {
|
|
120
|
+
state.isInfiniting = false;
|
|
121
|
+
};
|
|
122
|
+
const handleScroll = () => {
|
|
123
|
+
requestAniFrame()(() => {
|
|
124
|
+
if (!isScrollAtBottom() || !props.hasMore || state.isInfiniting) {
|
|
125
|
+
return false;
|
|
126
|
+
} else {
|
|
127
|
+
state.isInfiniting = true;
|
|
128
|
+
emit("load-more", infiniteDone);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
const scrollListener = () => {
|
|
133
|
+
state.scrollEl.addEventListener("scroll", handleScroll, props.useCapture);
|
|
134
|
+
};
|
|
135
|
+
const refreshDone = () => {
|
|
136
|
+
state.distance = 0;
|
|
137
|
+
state.isTouching = false;
|
|
138
|
+
};
|
|
139
|
+
const touchStart = (event) => {
|
|
140
|
+
if (state.beforeScrollTop == 0 && !state.isTouching && props.isOpenRefresh) {
|
|
141
|
+
state.y = event.touches[0].pageY;
|
|
142
|
+
state.isTouching = true;
|
|
143
|
+
const childHeight = state.refreshTop.firstElementChild.offsetHeight;
|
|
144
|
+
state.refreshMaxH = Math.floor(childHeight * 1 + 10);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const touchMove = (event) => {
|
|
148
|
+
state.distance = event.touches[0].pageY - state.y;
|
|
149
|
+
if (state.distance > 0 && state.isTouching) {
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
if (state.distance >= state.refreshMaxH)
|
|
152
|
+
state.distance = state.refreshMaxH;
|
|
153
|
+
} else {
|
|
154
|
+
state.distance = 0;
|
|
155
|
+
state.isTouching = false;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const touchEnd = () => {
|
|
159
|
+
if (state.distance) {
|
|
160
|
+
if (state.distance < state.refreshMaxH) {
|
|
161
|
+
state.distance = 0;
|
|
162
|
+
} else {
|
|
163
|
+
emit("refresh", refreshDone);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const getParentElement = (el) => {
|
|
168
|
+
return !!props.containerId ? document.querySelector(`#${props.containerId}`) : el && el.parentNode;
|
|
169
|
+
};
|
|
170
|
+
onMounted(() => {
|
|
171
|
+
const parentElement = getParentElement(state.scroller);
|
|
172
|
+
state.scrollEl = props.useWindow ? window : parentElement;
|
|
173
|
+
scrollListener();
|
|
174
|
+
console.log(slots);
|
|
175
|
+
});
|
|
176
|
+
onUnmounted(() => {
|
|
177
|
+
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
178
|
+
});
|
|
179
|
+
const isKeepAlive = ref(false);
|
|
180
|
+
onActivated(() => {
|
|
181
|
+
if (isKeepAlive.value) {
|
|
182
|
+
isKeepAlive.value = false;
|
|
183
|
+
scrollListener();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
onDeactivated(() => {
|
|
187
|
+
isKeepAlive.value = true;
|
|
188
|
+
state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
|
|
189
|
+
});
|
|
190
|
+
return {
|
|
191
|
+
classes,
|
|
192
|
+
...toRefs(state),
|
|
193
|
+
touchStart,
|
|
194
|
+
touchMove,
|
|
195
|
+
touchEnd,
|
|
196
|
+
getStyle,
|
|
197
|
+
translate,
|
|
198
|
+
slots
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const _hoisted_1 = { class: "top-box" };
|
|
203
|
+
const _hoisted_2 = { class: "top-text" };
|
|
204
|
+
const _hoisted_3 = { class: "nut-infinite-container" };
|
|
205
|
+
const _hoisted_4 = { class: "nut-infinite-bottom" };
|
|
206
|
+
const _hoisted_5 = {
|
|
207
|
+
key: 0,
|
|
208
|
+
class: "bottom-box"
|
|
209
|
+
};
|
|
210
|
+
const _hoisted_6 = { class: "bottom-text" };
|
|
211
|
+
const _hoisted_7 = {
|
|
212
|
+
key: 0,
|
|
213
|
+
class: "tips"
|
|
214
|
+
};
|
|
215
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
216
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
217
|
+
return openBlock(), createElementBlock("view", {
|
|
218
|
+
class: normalizeClass(_ctx.classes),
|
|
219
|
+
ref: "scroller",
|
|
220
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
|
|
221
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.touchMove && _ctx.touchMove(...args)),
|
|
222
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
|
|
223
|
+
}, [
|
|
224
|
+
createElementVNode("view", {
|
|
225
|
+
class: "nut-infinite-top",
|
|
226
|
+
ref: "refreshTop",
|
|
227
|
+
style: normalizeStyle(_ctx.getStyle)
|
|
228
|
+
}, [
|
|
229
|
+
createElementVNode("view", _hoisted_1, [
|
|
230
|
+
createVNode(_component_nut_icon, {
|
|
231
|
+
class: "top-img",
|
|
232
|
+
name: _ctx.pullIcon
|
|
233
|
+
}, null, 8, ["name"]),
|
|
234
|
+
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.pullTxt || _ctx.translate("pullTxt")), 1)
|
|
235
|
+
])
|
|
236
|
+
], 4),
|
|
237
|
+
createElementVNode("view", _hoisted_3, [
|
|
238
|
+
renderSlot(_ctx.$slots, "default")
|
|
239
|
+
]),
|
|
240
|
+
createElementVNode("view", _hoisted_4, [
|
|
241
|
+
_ctx.isInfiniting ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
242
|
+
!_ctx.slots.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
243
|
+
createVNode(_component_nut_icon, {
|
|
244
|
+
class: "bottom-img",
|
|
245
|
+
name: _ctx.loadIcon
|
|
246
|
+
}, null, 8, ["name"]),
|
|
247
|
+
createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt || _ctx.translate("loading")), 1)
|
|
248
|
+
], 64)) : renderSlot(_ctx.$slots, "loading", { key: 1 })
|
|
249
|
+
])) : !_ctx.hasMore ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
250
|
+
!_ctx.slots.finished ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt || _ctx.translate("loadMoreTxt")), 1)) : renderSlot(_ctx.$slots, "finished", { key: 1 })
|
|
251
|
+
], 64)) : createCommentVNode("", true)
|
|
252
|
+
])
|
|
253
|
+
], 34);
|
|
254
|
+
}
|
|
255
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
256
|
+
export { index as default };
|