@nutui/nutui 3.2.5-beta.1 → 3.2.6-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 +12 -0
- package/dist/nutui.es.js +4214 -4444
- package/dist/nutui.umd.js +4213 -4543
- package/dist/packages/_es/ActionSheet.js +18 -19
- package/dist/packages/_es/Address.js +94 -85
- package/dist/packages/_es/AddressList.js +25 -12
- package/dist/packages/_es/Animate.js +3 -3
- package/dist/packages/_es/Audio.js +9 -2
- package/dist/packages/_es/AudioOperate.js +5 -1
- package/dist/packages/_es/Avatar.js +10 -10
- package/dist/packages/_es/AvatarGroup.js +5 -5
- package/dist/packages/_es/BackTop.js +55 -108
- package/dist/packages/_es/Badge.js +6 -4
- package/dist/packages/_es/Barrage.js +79 -103
- package/dist/packages/_es/Button.js +5 -3
- package/dist/packages/_es/Calendar.js +36 -23
- package/dist/packages/_es/CalendarItem.js +4 -3
- package/dist/packages/_es/Card.js +15 -5
- package/dist/packages/_es/Cascader.js +12 -11
- package/dist/packages/_es/Category.js +13 -12
- package/dist/packages/_es/CategoryPane.js +17 -13
- package/dist/packages/_es/Cell.js +9 -12
- package/dist/packages/_es/CellGroup.js +4 -2
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +2 -2
- package/dist/packages/_es/CircleProgress.js +98 -82
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +65 -34
- package/dist/packages/_es/CollapseItem.js +93 -60
- package/dist/packages/_es/Comment.js +43 -19
- package/dist/packages/_es/ConfigProvider.js +1 -1
- package/dist/packages/_es/CountDown.js +3 -3
- package/dist/packages/_es/CountUp.js +47 -52
- package/dist/packages/_es/DatePicker.js +37 -54
- package/dist/packages/_es/Dialog.js +9 -88
- package/dist/packages/_es/Divider.js +3 -3
- package/dist/packages/_es/Drag.js +75 -49
- package/dist/packages/_es/Ecard.js +20 -18
- package/dist/packages/_es/Elevator.js +101 -76
- package/dist/packages/_es/Ellipsis.js +140 -100
- package/dist/packages/_es/Empty.js +6 -4
- package/dist/packages/_es/FixedNav.js +11 -6
- package/dist/packages/_es/Form.js +4 -4
- package/dist/packages/_es/FormItem.js +3 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +10 -27
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/Image.js +13 -114
- package/dist/packages/_es/ImagePreview.js +154 -400
- package/dist/packages/_es/Indicator.js +3 -3
- package/dist/packages/_es/InfiniteLoading.js +103 -115
- package/dist/packages/_es/Input.js +54 -26
- package/dist/packages/_es/InputNumber.js +25 -16
- package/dist/packages/_es/Invoice.js +6 -5
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/List.js +47 -34
- package/dist/packages/_es/Menu.js +35 -35
- package/dist/packages/_es/MenuItem.js +56 -29
- package/dist/packages/_es/Navbar.js +49 -39
- package/dist/packages/_es/NoticeBar.js +52 -41
- package/dist/packages/_es/Notify.js +37 -166
- package/dist/packages/_es/NumberKeyboard.js +15 -20
- package/dist/packages/_es/OldPicker.js +130 -116
- package/dist/packages/_es/OverLay.js +5 -28
- package/dist/packages/_es/Pagination.js +8 -5
- package/dist/packages/_es/Picker.js +196 -65
- package/dist/packages/_es/Popover.js +201 -881
- package/dist/packages/_es/Popup.js +28 -84
- package/dist/packages/_es/Price.js +22 -6
- package/dist/packages/_es/Progress.js +18 -11
- package/dist/packages/_es/PullRefresh.js +4 -2
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +48 -34
- package/dist/packages/_es/Rate.js +15 -14
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +39 -36
- package/dist/packages/_es/ShortPassword.js +97 -66
- package/dist/packages/_es/SideNavBar.js +7 -18
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +113 -80
- package/dist/packages/_es/Skeleton.js +12 -11
- package/dist/packages/_es/Sku.js +63 -38
- package/dist/packages/_es/Step.js +7 -2
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +33 -23
- package/dist/packages/_es/SubSideNavBar.js +4 -2
- package/dist/packages/_es/Swipe.js +41 -26
- package/dist/packages/_es/Swiper.js +38 -21
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +8 -8
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +40 -9
- package/dist/packages/_es/TabbarItem.js +24 -30
- package/dist/packages/_es/Table.js +22 -17
- package/dist/packages/_es/Tabs.js +49 -16
- package/dist/packages/_es/Tag.js +6 -5
- package/dist/packages/_es/TextArea.js +114 -49
- package/dist/packages/_es/TimeDetail.js +4 -3
- package/dist/packages/_es/TimePannel.js +3 -3
- package/dist/packages/_es/TimeSelect.js +12 -10
- package/dist/packages/_es/Toast.js +53 -164
- package/dist/packages/_es/TrendArrow.js +6 -4
- package/dist/packages/_es/Uploader.js +141 -140
- package/dist/packages/_es/Video.js +72 -5
- package/dist/packages/_es/WaterMark.js +22 -14
- 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} +167 -154
- package/dist/packages/_es/index2.js +8 -31
- package/dist/packages/_es/index3.js +64 -7
- package/dist/packages/_es/index4.js +424 -62
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/style.css +21 -3
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/locale/lang/baseLang.js +1 -1
- package/dist/packages/locale/lang/en-US.js +1 -1
- package/dist/packages/locale/lang/id-ID.js +1 -1
- package/dist/packages/locale/lang/index.js +1 -1
- package/dist/packages/locale/lang/zh-CN.js +1 -1
- package/dist/packages/locale/lang/zh-TW.js +1 -1
- package/dist/packages/signature/index.scss +4 -1
- package/dist/packages/swiperitem/index.scss +1 -1
- package/dist/smartips/attributes.json +4 -0
- package/dist/smartips/tags.json +2 -1
- package/dist/smartips/web-types.json +10 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +44 -44
- package/dist/styles/themes/jdb.scss +44 -44
- package/dist/styles/themes/jddkh.scss +44 -44
- package/dist/styles/themes/jdt.scss +44 -44
- package/dist/types/__VUE/actionsheet/{index.vue.d.ts → index.taro.vue.d.ts} +9 -9
- package/dist/types/__VUE/address/{index.vue.d.ts → index.taro.vue.d.ts} +73 -33
- package/dist/types/__VUE/addresslist/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/animate/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/avatar/{index.vue.d.ts → index.taro.vue.d.ts} +6 -6
- package/dist/types/__VUE/avatargroup/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/backtop/{index.vue.d.ts → index.taro.vue.d.ts} +15 -37
- package/dist/types/__VUE/badge/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/barrage/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
- package/dist/types/__VUE/button/index.taro.vue.d.ts +116 -0
- package/dist/types/__VUE/button/index.vue.d.ts +1 -1
- package/dist/types/__VUE/calendar/{index.vue.d.ts → index.taro.vue.d.ts} +13 -1
- package/dist/types/__VUE/calendaritem/{index.vue.d.ts → index.taro.vue.d.ts} +17 -17
- package/dist/types/__VUE/card/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/cascader/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/__VUE/category/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/categorypane/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/cell/{index.vue.d.ts → index.taro.vue.d.ts} +13 -6
- package/dist/types/__VUE/checkbox/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/circleprogress/{index.vue.d.ts → index.taro.vue.d.ts} +14 -15
- package/dist/types/__VUE/collapse/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/__VUE/collapseitem/{index.vue.d.ts → index.taro.vue.d.ts} +2 -10
- package/dist/types/__VUE/comment/{index.vue.d.ts → index.taro.vue.d.ts} +1 -2
- package/dist/types/__VUE/configprovider/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/countdown/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/countup/{index.vue.d.ts → index.taro.vue.d.ts} +5 -7
- package/dist/types/__VUE/datepicker/{index.vue.d.ts → index.taro.vue.d.ts} +5 -5
- package/dist/types/__VUE/dialog/{index.vue.d.ts → index.taro.vue.d.ts} +9 -12
- package/dist/types/__VUE/divider/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/__VUE/drag/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
- package/dist/types/__VUE/ecard/{index.vue.d.ts → index.taro.vue.d.ts} +3 -3
- package/dist/types/__VUE/elevator/{index.vue.d.ts → index.taro.vue.d.ts} +11 -2
- package/dist/types/__VUE/ellipsis/{index.vue.d.ts → index.taro.vue.d.ts} +4 -0
- package/dist/types/__VUE/empty/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/fixednav/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/form/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/grid/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/__VUE/griditem/{index.vue.d.ts → index.taro.vue.d.ts} +2 -27
- package/dist/types/__VUE/icon/index.taro.vue.d.ts +74 -0
- package/dist/types/__VUE/image/index.taro.vue.d.ts +33 -0
- package/dist/types/__VUE/imagepreview/{index.vue.d.ts → index.taro.vue.d.ts} +40 -42
- package/dist/types/__VUE/indicator/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/infiniteloading/{index.vue.d.ts → index.taro.vue.d.ts} +15 -8
- package/dist/types/__VUE/input/{index.vue.d.ts → index.taro.vue.d.ts} +34 -16
- package/dist/types/__VUE/inputnumber/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
- package/dist/types/__VUE/invoice/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/layout/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/list/{index.vue.d.ts → index.taro.vue.d.ts} +2 -2
- package/dist/types/__VUE/menu/{index.vue.d.ts → index.taro.vue.d.ts} +1 -0
- package/dist/types/__VUE/menuitem/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/navbar/{index.vue.d.ts → index.taro.vue.d.ts} +1 -2
- package/dist/types/__VUE/noticebar/{index.vue.d.ts → index.taro.vue.d.ts} +4 -3
- package/dist/types/__VUE/notify/{index.vue.d.ts → index.taro.vue.d.ts} +10 -25
- package/dist/types/__VUE/numberkeyboard/{index.vue.d.ts → index.taro.vue.d.ts} +5 -29
- package/dist/types/__VUE/oldpicker/{Column.vue.d.ts → ColumnTaro.vue.d.ts} +28 -17
- package/dist/types/__VUE/oldpicker/{index.vue.d.ts → index.taro.vue.d.ts} +64 -44
- package/dist/types/__VUE/overlay/index.taro.vue.d.ts +85 -0
- package/dist/types/__VUE/pagination/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/picker/{Column.vue.d.ts → ColumnTaro.vue.d.ts} +16 -4
- package/dist/types/__VUE/picker/{index.vue.d.ts → index.taro.vue.d.ts} +53 -28
- package/dist/types/__VUE/popover/{index.vue.d.ts → index.taro.vue.d.ts} +15 -13
- package/dist/types/__VUE/popup/index.taro.vue.d.ts +1728 -0
- package/dist/types/__VUE/popup/index.vue.d.ts +1 -1
- package/dist/types/__VUE/price/{index.vue.d.ts → index.taro.vue.d.ts} +1 -0
- package/dist/types/__VUE/progress/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/__VUE/radio/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/range/{index.vue.d.ts → index.taro.vue.d.ts} +8 -7
- package/dist/types/__VUE/rate/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/searchbar/{index.vue.d.ts → index.taro.vue.d.ts} +19 -19
- package/dist/types/__VUE/shortpassword/{index.vue.d.ts → index.taro.vue.d.ts} +6 -21
- package/dist/types/__VUE/sidenavbar/{index.vue.d.ts → index.taro.vue.d.ts} +0 -5
- package/dist/types/__VUE/signature/{index.vue.d.ts → index.taro.vue.d.ts} +8 -5
- package/dist/types/__VUE/skeleton/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/sku/{index.vue.d.ts → index.taro.vue.d.ts} +54 -182
- package/dist/types/__VUE/step/index.vue.d.ts +1 -1
- package/dist/types/__VUE/steps/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/sticky/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/swipe/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
- package/dist/types/__VUE/swiper/{index.vue.d.ts → index.taro.vue.d.ts} +2 -1
- package/dist/types/__VUE/swiperitem/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/switch/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/tabbar/{index.vue.d.ts → index.taro.vue.d.ts} +10 -0
- package/dist/types/__VUE/tabbaritem/{index.vue.d.ts → index.taro.vue.d.ts} +9 -9
- package/dist/types/__VUE/table/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/tabs/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/tag/{index.vue.d.ts → index.taro.vue.d.ts} +4 -4
- package/dist/types/__VUE/textarea/{index.vue.d.ts → index.taro.vue.d.ts} +5 -3
- package/dist/types/__VUE/timedetail/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/timepannel/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/timeselect/{index.vue.d.ts → index.taro.vue.d.ts} +7 -8
- package/dist/types/__VUE/toast/{index.vue.d.ts → index.taro.vue.d.ts} +44 -22
- package/dist/types/__VUE/trendarrow/{index.vue.d.ts → index.taro.vue.d.ts} +0 -0
- package/dist/types/__VUE/uploader/{index.vue.d.ts → index.taro.vue.d.ts} +22 -13
- package/dist/types/__VUE/video/index.vue.d.ts +3 -1
- package/dist/types/__VUE/watermark/{index.vue.d.ts → index.taro.vue.d.ts} +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +89 -89
- package/package.json +1 -1
- package/dist/types/__VUE/dialog/index.d.ts +0 -48
- package/dist/types/__VUE/image/index.vue.d.ts +0 -117
- package/dist/types/__VUE/image/type.d.ts +0 -6
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +0 -108
- package/dist/types/__VUE/imagepreview/index.d.ts +0 -25
- package/dist/types/__VUE/notify/index.d.ts +0 -26
- package/dist/types/__VUE/tag/type.d.ts +0 -5
- package/dist/types/__VUE/toast/index.d.ts +0 -16
|
@@ -1,294 +1,22 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.2.
|
|
2
|
+
* @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx,
|
|
6
|
+
import { reactive, computed, watch, onMounted, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, createCommentVNode, createTextVNode, toDisplayString, normalizeStyle, createVNode, mergeProps } from "vue";
|
|
7
7
|
import { c as createComponent, i as isPromise } from "./component.js";
|
|
8
8
|
import Popup from "./Popup.js";
|
|
9
|
-
import Video from "./Video.js";
|
|
10
9
|
import Swiper from "./Swiper.js";
|
|
11
10
|
import SwiperItem from "./SwiperItem.js";
|
|
12
|
-
import _sfc_main$
|
|
13
|
-
import { u as useTouch } from "./index4.js";
|
|
11
|
+
import _sfc_main$1 from "./Icon.js";
|
|
14
12
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
15
13
|
import "../locale/lang";
|
|
14
|
+
import "./use-lock-scroll.js";
|
|
16
15
|
import "./OverLay.js";
|
|
17
16
|
import "./pxCheck.js";
|
|
18
|
-
import "./
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
props: {
|
|
22
|
-
show: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
},
|
|
26
|
-
initNo: Number,
|
|
27
|
-
image: {
|
|
28
|
-
type: Object,
|
|
29
|
-
default: () => ({})
|
|
30
|
-
},
|
|
31
|
-
video: {
|
|
32
|
-
type: Object,
|
|
33
|
-
default: () => ({})
|
|
34
|
-
},
|
|
35
|
-
showIndex: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: true
|
|
38
|
-
},
|
|
39
|
-
rootWidth: {
|
|
40
|
-
type: Number,
|
|
41
|
-
default: 0
|
|
42
|
-
},
|
|
43
|
-
rootHeight: {
|
|
44
|
-
type: Number,
|
|
45
|
-
default: 0
|
|
46
|
-
},
|
|
47
|
-
minZoom: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: 1 / 3
|
|
50
|
-
},
|
|
51
|
-
maxZoom: {
|
|
52
|
-
type: Number,
|
|
53
|
-
default: 3
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
emits: ["close", "scale"],
|
|
57
|
-
components: {
|
|
58
|
-
[Popup.name]: Popup,
|
|
59
|
-
[Video.name]: Video,
|
|
60
|
-
[Swiper.name]: Swiper,
|
|
61
|
-
[SwiperItem.name]: SwiperItem,
|
|
62
|
-
[_sfc_main$2.name]: _sfc_main$2
|
|
63
|
-
},
|
|
64
|
-
setup(props, { emit }) {
|
|
65
|
-
const state = reactive({
|
|
66
|
-
scale: 1,
|
|
67
|
-
moveX: 0,
|
|
68
|
-
moveY: 0,
|
|
69
|
-
moving: false,
|
|
70
|
-
zooming: false,
|
|
71
|
-
imageRatio: 0,
|
|
72
|
-
displayWidth: 0,
|
|
73
|
-
displayHeight: 0
|
|
74
|
-
});
|
|
75
|
-
const touch = useTouch();
|
|
76
|
-
const vertical = computed(() => {
|
|
77
|
-
const { rootWidth, rootHeight } = props;
|
|
78
|
-
const rootRatio = rootHeight / rootWidth;
|
|
79
|
-
return state.imageRatio > rootRatio;
|
|
80
|
-
});
|
|
81
|
-
const imageStyle = computed(() => {
|
|
82
|
-
const { scale, moveX, moveY, moving, zooming } = state;
|
|
83
|
-
const style = {
|
|
84
|
-
transitionDuration: zooming || moving ? "0s" : ".3s"
|
|
85
|
-
};
|
|
86
|
-
if (scale !== 1) {
|
|
87
|
-
const offsetX = moveX / scale;
|
|
88
|
-
const offsetY = moveY / scale;
|
|
89
|
-
style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
|
|
90
|
-
}
|
|
91
|
-
return style;
|
|
92
|
-
});
|
|
93
|
-
const maxMoveX = computed(() => {
|
|
94
|
-
if (state.imageRatio) {
|
|
95
|
-
const { rootWidth, rootHeight } = props;
|
|
96
|
-
const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
|
|
97
|
-
return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
|
|
98
|
-
}
|
|
99
|
-
return 0;
|
|
100
|
-
});
|
|
101
|
-
const maxMoveY = computed(() => {
|
|
102
|
-
if (state.imageRatio) {
|
|
103
|
-
const { rootWidth, rootHeight } = props;
|
|
104
|
-
const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
|
|
105
|
-
return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
|
|
106
|
-
}
|
|
107
|
-
return 0;
|
|
108
|
-
});
|
|
109
|
-
const imageLoad = (event) => {
|
|
110
|
-
const { naturalWidth, naturalHeight } = event.target;
|
|
111
|
-
state.imageRatio = naturalHeight / naturalWidth;
|
|
112
|
-
};
|
|
113
|
-
const resetScale = () => {
|
|
114
|
-
setScale(1);
|
|
115
|
-
state.moveX = 0;
|
|
116
|
-
state.moveY = 0;
|
|
117
|
-
};
|
|
118
|
-
const setScale = (scale) => {
|
|
119
|
-
scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
|
|
120
|
-
if (scale !== state.scale) {
|
|
121
|
-
state.scale = scale;
|
|
122
|
-
emit("scale", {
|
|
123
|
-
scale,
|
|
124
|
-
index: props.initNo
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const toggleScale = () => {
|
|
129
|
-
const scale = state.scale > 1 ? 1 : 2;
|
|
130
|
-
setScale(scale);
|
|
131
|
-
state.moveX = 0;
|
|
132
|
-
state.moveY = 0;
|
|
133
|
-
};
|
|
134
|
-
const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
|
|
135
|
-
let startMoveX;
|
|
136
|
-
let startMoveY;
|
|
137
|
-
let startScale;
|
|
138
|
-
let startDistance;
|
|
139
|
-
let doubleTapTimer;
|
|
140
|
-
let touchStartTime;
|
|
141
|
-
let fingerNum;
|
|
142
|
-
const onTouchStart = (event) => {
|
|
143
|
-
const { touches } = event;
|
|
144
|
-
const { offsetX } = touch;
|
|
145
|
-
touch.start(event);
|
|
146
|
-
fingerNum = touches.length;
|
|
147
|
-
startMoveX = state.moveX;
|
|
148
|
-
startMoveY = state.moveY;
|
|
149
|
-
touchStartTime = Date.now();
|
|
150
|
-
state.moving = fingerNum === 1 && state.scale !== 1;
|
|
151
|
-
state.zooming = fingerNum === 2 && !offsetX.value;
|
|
152
|
-
if (state.zooming) {
|
|
153
|
-
startScale = state.scale;
|
|
154
|
-
startDistance = getDistance(event.touches);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const onTouchMove = (event) => {
|
|
158
|
-
const { touches } = event;
|
|
159
|
-
touch.move(event);
|
|
160
|
-
if (state.moving || state.zooming) {
|
|
161
|
-
preventDefault(event, true);
|
|
162
|
-
}
|
|
163
|
-
if (state.moving) {
|
|
164
|
-
const { deltaX, deltaY } = touch;
|
|
165
|
-
const moveX = deltaX.value + startMoveX;
|
|
166
|
-
const moveY = deltaY.value + startMoveY;
|
|
167
|
-
state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
|
168
|
-
state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
|
169
|
-
}
|
|
170
|
-
if (state.zooming && touches.length === 2) {
|
|
171
|
-
const distance = getDistance(touches);
|
|
172
|
-
const scale = startScale * distance / startDistance;
|
|
173
|
-
setScale(scale);
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
const checkTap = () => {
|
|
177
|
-
if (fingerNum > 1) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const { offsetX, offsetY } = touch;
|
|
181
|
-
const deltaTime = Date.now() - touchStartTime;
|
|
182
|
-
const TAP_TIME = 250;
|
|
183
|
-
const TAP_OFFSET = 5;
|
|
184
|
-
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET && deltaTime < TAP_TIME) {
|
|
185
|
-
if (doubleTapTimer) {
|
|
186
|
-
clearTimeout(doubleTapTimer);
|
|
187
|
-
doubleTapTimer = null;
|
|
188
|
-
toggleScale();
|
|
189
|
-
} else {
|
|
190
|
-
doubleTapTimer = setTimeout(() => {
|
|
191
|
-
emit("close");
|
|
192
|
-
doubleTapTimer = null;
|
|
193
|
-
}, TAP_TIME);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const onTouchEnd = (event) => {
|
|
198
|
-
let stopPropagation = false;
|
|
199
|
-
if (state.moving || state.zooming) {
|
|
200
|
-
stopPropagation = true;
|
|
201
|
-
if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
|
|
202
|
-
stopPropagation = false;
|
|
203
|
-
}
|
|
204
|
-
if (!event.touches.length) {
|
|
205
|
-
if (state.zooming) {
|
|
206
|
-
state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
|
|
207
|
-
state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
|
|
208
|
-
state.zooming = false;
|
|
209
|
-
}
|
|
210
|
-
state.moving = false;
|
|
211
|
-
startMoveX = 0;
|
|
212
|
-
startMoveY = 0;
|
|
213
|
-
startScale = 1;
|
|
214
|
-
if (state.scale < 1) {
|
|
215
|
-
resetScale();
|
|
216
|
-
}
|
|
217
|
-
if (state.scale > props.maxZoom) {
|
|
218
|
-
state.scale = +props.maxZoom;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
preventDefault(event, stopPropagation);
|
|
223
|
-
checkTap();
|
|
224
|
-
touch.reset();
|
|
225
|
-
};
|
|
226
|
-
const preventDefault = (event, isStopPropagation) => {
|
|
227
|
-
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
228
|
-
event.preventDefault();
|
|
229
|
-
}
|
|
230
|
-
if (isStopPropagation) {
|
|
231
|
-
event.stopPropagation();
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
235
|
-
watch(() => props.initNo, resetScale);
|
|
236
|
-
watch(
|
|
237
|
-
() => props.show,
|
|
238
|
-
(value) => {
|
|
239
|
-
if (!value) {
|
|
240
|
-
resetScale();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
return {
|
|
245
|
-
...toRefs(state),
|
|
246
|
-
onTouchStart,
|
|
247
|
-
onTouchMove,
|
|
248
|
-
onTouchEnd,
|
|
249
|
-
getDistance,
|
|
250
|
-
imageStyle,
|
|
251
|
-
imageLoad
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
const _hoisted_1$1 = ["src"];
|
|
256
|
-
const _hoisted_2$1 = {
|
|
257
|
-
key: 1,
|
|
258
|
-
class: "nut-imagepreview-box"
|
|
259
|
-
};
|
|
260
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
261
|
-
const _component_nut_video = resolveComponent("nut-video");
|
|
262
|
-
const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
|
|
263
|
-
return openBlock(), createBlock(_component_nut_swiper_item, {
|
|
264
|
-
onTouchstart: _ctx.onTouchStart,
|
|
265
|
-
onTouchmove: _ctx.onTouchMove,
|
|
266
|
-
onTouchend: _ctx.onTouchEnd,
|
|
267
|
-
onTouchcancel: _ctx.onTouchEnd
|
|
268
|
-
}, {
|
|
269
|
-
default: withCtx(() => [
|
|
270
|
-
_ctx.image && _ctx.image.src ? (openBlock(), createElementBlock("view", {
|
|
271
|
-
key: 0,
|
|
272
|
-
style: normalizeStyle(_ctx.imageStyle),
|
|
273
|
-
class: "nut-imagepreview-box"
|
|
274
|
-
}, [
|
|
275
|
-
createElementVNode("img", {
|
|
276
|
-
src: _ctx.image.src,
|
|
277
|
-
class: "nut-imagepreview-img",
|
|
278
|
-
onLoad: _cache[0] || (_cache[0] = (...args) => _ctx.imageLoad && _ctx.imageLoad(...args))
|
|
279
|
-
}, null, 40, _hoisted_1$1)
|
|
280
|
-
], 4)) : createCommentVNode("", true),
|
|
281
|
-
_ctx.video && _ctx.video.source ? (openBlock(), createElementBlock("view", _hoisted_2$1, [
|
|
282
|
-
createVNode(_component_nut_video, {
|
|
283
|
-
source: _ctx.video.source,
|
|
284
|
-
options: _ctx.video.options
|
|
285
|
-
}, null, 8, ["source", "options"])
|
|
286
|
-
])) : createCommentVNode("", true)
|
|
287
|
-
]),
|
|
288
|
-
_: 1
|
|
289
|
-
}, 8, ["onTouchstart", "onTouchmove", "onTouchend", "onTouchcancel"]);
|
|
290
|
-
}
|
|
291
|
-
var ImagePreviewItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
17
|
+
import "./index.js";
|
|
18
|
+
import "./index2.js";
|
|
19
|
+
import "@tarojs/taro";
|
|
292
20
|
const { create } = createComponent("imagepreview");
|
|
293
21
|
const _sfc_main = create({
|
|
294
22
|
props: {
|
|
@@ -300,13 +28,9 @@ const _sfc_main = create({
|
|
|
300
28
|
type: Array,
|
|
301
29
|
default: () => []
|
|
302
30
|
},
|
|
303
|
-
videos: {
|
|
304
|
-
type: Array,
|
|
305
|
-
default: () => []
|
|
306
|
-
},
|
|
307
31
|
contentClose: {
|
|
308
32
|
type: Boolean,
|
|
309
|
-
default:
|
|
33
|
+
default: false
|
|
310
34
|
},
|
|
311
35
|
initNo: {
|
|
312
36
|
type: Number,
|
|
@@ -322,11 +46,7 @@ const _sfc_main = create({
|
|
|
322
46
|
},
|
|
323
47
|
autoplay: {
|
|
324
48
|
type: [Number, String],
|
|
325
|
-
default:
|
|
326
|
-
},
|
|
327
|
-
isWrapTeleport: {
|
|
328
|
-
type: Boolean,
|
|
329
|
-
default: false
|
|
49
|
+
default: 3e3
|
|
330
50
|
},
|
|
331
51
|
showIndex: {
|
|
332
52
|
type: Boolean,
|
|
@@ -345,32 +65,39 @@ const _sfc_main = create({
|
|
|
345
65
|
default: "top-right"
|
|
346
66
|
},
|
|
347
67
|
beforeClose: Function,
|
|
348
|
-
|
|
349
|
-
type:
|
|
350
|
-
default:
|
|
351
|
-
},
|
|
352
|
-
maxZoom: {
|
|
353
|
-
type: Number,
|
|
354
|
-
default: 3
|
|
68
|
+
isLoop: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: true
|
|
355
71
|
}
|
|
356
72
|
},
|
|
357
73
|
emits: ["close", "change"],
|
|
358
74
|
components: {
|
|
359
75
|
[Popup.name]: Popup,
|
|
360
|
-
[Video.name]: Video,
|
|
361
76
|
[Swiper.name]: Swiper,
|
|
362
77
|
[SwiperItem.name]: SwiperItem,
|
|
363
|
-
[_sfc_main$
|
|
364
|
-
ImagePreviewItem
|
|
78
|
+
[_sfc_main$1.name]: _sfc_main$1
|
|
365
79
|
},
|
|
366
80
|
setup(props, { emit }) {
|
|
367
|
-
const swipeRef = ref();
|
|
368
81
|
const state = reactive({
|
|
369
82
|
showPop: false,
|
|
370
83
|
active: 1,
|
|
371
84
|
maxNo: 1,
|
|
372
|
-
|
|
373
|
-
|
|
85
|
+
source: {
|
|
86
|
+
src: "https://storage.jd.com/about/big-final.mp4?Expires=3730193075&AccessKey=3LoYX1dQWa6ZXzQl&Signature=ViMFjz%2BOkBxS%2FY1rjtUVqbopbJI%3D",
|
|
87
|
+
type: "video/mp4"
|
|
88
|
+
},
|
|
89
|
+
options: {
|
|
90
|
+
muted: true,
|
|
91
|
+
controls: true
|
|
92
|
+
},
|
|
93
|
+
eleImg: null,
|
|
94
|
+
store: {
|
|
95
|
+
scale: 1,
|
|
96
|
+
moveable: false,
|
|
97
|
+
originScale: 1,
|
|
98
|
+
oriDistance: 1
|
|
99
|
+
},
|
|
100
|
+
lastTouchEndTime: 0
|
|
374
101
|
});
|
|
375
102
|
const styles = computed(() => {
|
|
376
103
|
let style = {};
|
|
@@ -385,6 +112,11 @@ const _sfc_main = create({
|
|
|
385
112
|
state.active = page + 1;
|
|
386
113
|
emit("change", state.active);
|
|
387
114
|
};
|
|
115
|
+
const closeOnImg = () => {
|
|
116
|
+
if (props.contentClose) {
|
|
117
|
+
onClose();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
388
120
|
const onClose = () => {
|
|
389
121
|
if (props.beforeClose) {
|
|
390
122
|
const returnVal = props.beforeClose.apply(null, state.active);
|
|
@@ -403,17 +135,90 @@ const _sfc_main = create({
|
|
|
403
135
|
};
|
|
404
136
|
const closeDone = () => {
|
|
405
137
|
state.showPop = false;
|
|
138
|
+
state.store.scale = 1;
|
|
139
|
+
scaleNow();
|
|
406
140
|
state.active = 1;
|
|
407
141
|
emit("close");
|
|
408
142
|
};
|
|
409
|
-
const
|
|
410
|
-
|
|
143
|
+
const getDistance = (first, second) => {
|
|
144
|
+
return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
|
|
145
|
+
};
|
|
146
|
+
const scaleNow = () => {
|
|
147
|
+
if (state.eleImg != null) {
|
|
148
|
+
state.eleImg.style.transform = "scale(" + state.store.scale + ")";
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const onTouchStart = (event) => {
|
|
152
|
+
const curTouchTime = new Date().getTime();
|
|
153
|
+
if (curTouchTime - state.lastTouchEndTime < 300) {
|
|
154
|
+
const store2 = state.store;
|
|
155
|
+
if (store2.scale > 1) {
|
|
156
|
+
store2.scale = 1;
|
|
157
|
+
} else if (store2.scale == 1) {
|
|
158
|
+
store2.scale = 2;
|
|
159
|
+
}
|
|
160
|
+
scaleNow();
|
|
161
|
+
}
|
|
162
|
+
var touches = event.touches;
|
|
163
|
+
var events = touches[0];
|
|
164
|
+
var events2 = touches[1];
|
|
165
|
+
const store = state.store;
|
|
166
|
+
store.moveable = true;
|
|
167
|
+
if (events2) {
|
|
168
|
+
store.oriDistance = getDistance(
|
|
169
|
+
{
|
|
170
|
+
x: events.pageX,
|
|
171
|
+
y: events.pageY
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
x: events2.pageX,
|
|
175
|
+
y: events2.pageY
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
store.originScale = store.scale || 1;
|
|
180
|
+
};
|
|
181
|
+
const onTouchMove = (event) => {
|
|
182
|
+
if (!state.store.moveable) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const store = state.store;
|
|
186
|
+
var touches = event.touches;
|
|
187
|
+
var events = touches[0];
|
|
188
|
+
var events2 = touches[1];
|
|
189
|
+
if (events2) {
|
|
190
|
+
const curDistance = getDistance(
|
|
191
|
+
{
|
|
192
|
+
x: events.pageX,
|
|
193
|
+
y: events.pageY
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
x: events2.pageX,
|
|
197
|
+
y: events2.pageY
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
const curScale = curDistance / store.oriDistance;
|
|
201
|
+
store.scale = store.originScale * curScale;
|
|
202
|
+
if (store.scale > 3) {
|
|
203
|
+
store.scale = 3;
|
|
204
|
+
}
|
|
205
|
+
scaleNow();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const onTouchEnd = () => {
|
|
209
|
+
state.lastTouchEndTime = new Date().getTime();
|
|
210
|
+
const store = state.store;
|
|
211
|
+
store.moveable = false;
|
|
212
|
+
if (store.scale < 1.1 && store.scale > 1 || store.scale < 1) {
|
|
213
|
+
store.scale = 1;
|
|
214
|
+
scaleNow();
|
|
215
|
+
}
|
|
411
216
|
};
|
|
412
217
|
const init = () => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
218
|
+
state.eleImg = document.querySelector(".nut-imagepreview");
|
|
219
|
+
document.addEventListener("touchmove", onTouchMove);
|
|
220
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
221
|
+
document.addEventListener("touchcancel", onTouchEnd);
|
|
417
222
|
};
|
|
418
223
|
watch(
|
|
419
224
|
() => props.show,
|
|
@@ -422,50 +227,56 @@ const _sfc_main = create({
|
|
|
422
227
|
init();
|
|
423
228
|
}
|
|
424
229
|
);
|
|
230
|
+
const handleCloseIcon = () => {
|
|
231
|
+
onClose();
|
|
232
|
+
};
|
|
425
233
|
onMounted(() => {
|
|
426
234
|
state.active = props.initNo;
|
|
427
235
|
state.showPop = props.show;
|
|
428
|
-
state.maxNo = props.images.length
|
|
236
|
+
state.maxNo = props.images.length;
|
|
429
237
|
});
|
|
430
238
|
return {
|
|
431
|
-
swipeRef,
|
|
432
239
|
...toRefs(state),
|
|
433
240
|
slideChangeEnd,
|
|
434
241
|
onClose,
|
|
435
|
-
|
|
436
|
-
|
|
242
|
+
closeOnImg,
|
|
243
|
+
onTouchStart,
|
|
244
|
+
onTouchMove,
|
|
245
|
+
onTouchEnd,
|
|
246
|
+
getDistance,
|
|
247
|
+
scaleNow,
|
|
248
|
+
styles,
|
|
249
|
+
handleCloseIcon
|
|
437
250
|
};
|
|
438
251
|
}
|
|
439
252
|
});
|
|
440
|
-
const _hoisted_1 =
|
|
441
|
-
class: "nut-imagepreview",
|
|
442
|
-
ref: "swipeRef"
|
|
443
|
-
};
|
|
253
|
+
const _hoisted_1 = ["src"];
|
|
444
254
|
const _hoisted_2 = {
|
|
445
255
|
key: 0,
|
|
446
256
|
class: "nut-imagepreview-index"
|
|
447
257
|
};
|
|
448
258
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
449
|
-
const
|
|
259
|
+
const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
|
|
450
260
|
const _component_nut_swiper = resolveComponent("nut-swiper");
|
|
451
261
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
452
262
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
453
263
|
return openBlock(), createBlock(_component_nut_popup, {
|
|
454
264
|
"pop-class": "custom-pop",
|
|
455
265
|
visible: _ctx.showPop,
|
|
456
|
-
"onUpdate:visible": _cache[
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
style: { "width": "100%" },
|
|
460
|
-
"lock-scroll": ""
|
|
266
|
+
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.showPop = $event),
|
|
267
|
+
onClick: _ctx.onClose,
|
|
268
|
+
style: { "width": "100%" }
|
|
461
269
|
}, {
|
|
462
270
|
default: withCtx(() => [
|
|
463
|
-
createElementVNode("view",
|
|
271
|
+
createElementVNode("view", {
|
|
272
|
+
class: "nut-imagepreview",
|
|
273
|
+
onTouchstartCapture: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args))
|
|
274
|
+
}, [
|
|
464
275
|
_ctx.showPop ? (openBlock(), createBlock(_component_nut_swiper, {
|
|
465
276
|
key: 0,
|
|
466
277
|
"auto-play": _ctx.autoplay,
|
|
467
278
|
class: "nut-imagepreview-swiper",
|
|
468
|
-
loop:
|
|
279
|
+
loop: _ctx.isLoop,
|
|
469
280
|
"is-preventDefault": false,
|
|
470
281
|
direction: "horizontal",
|
|
471
282
|
onChange: _ctx.slideChangeEnd,
|
|
@@ -474,93 +285,36 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
474
285
|
"pagination-color": _ctx.paginationColor
|
|
475
286
|
}, {
|
|
476
287
|
default: withCtx(() => [
|
|
477
|
-
_ctx.videos.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.videos, (item, index) => {
|
|
478
|
-
return openBlock(), createBlock(_component_image_preview_item, {
|
|
479
|
-
key: index,
|
|
480
|
-
video: item,
|
|
481
|
-
rootHeight: _ctx.rootHeight,
|
|
482
|
-
rootWidth: _ctx.rootWidth,
|
|
483
|
-
show: _ctx.showPop,
|
|
484
|
-
"init-no": _ctx.active,
|
|
485
|
-
onClose: _ctx.onClose,
|
|
486
|
-
maxZoom: _ctx.maxZoom,
|
|
487
|
-
minZoom: _ctx.minZoom
|
|
488
|
-
}, null, 8, ["video", "rootHeight", "rootWidth", "show", "init-no", "onClose", "maxZoom", "minZoom"]);
|
|
489
|
-
}), 128)) : createCommentVNode("", true),
|
|
490
288
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item, index) => {
|
|
491
|
-
return openBlock(), createBlock(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
289
|
+
return openBlock(), createBlock(_component_nut_swiper_item, { key: index }, {
|
|
290
|
+
default: withCtx(() => [
|
|
291
|
+
createElementVNode("img", {
|
|
292
|
+
src: item.src,
|
|
293
|
+
mode: "aspectFit",
|
|
294
|
+
class: "nut-imagepreview-img"
|
|
295
|
+
}, null, 8, _hoisted_1)
|
|
296
|
+
]),
|
|
297
|
+
_: 2
|
|
298
|
+
}, 1024);
|
|
500
299
|
}), 128))
|
|
501
300
|
]),
|
|
502
301
|
_: 1
|
|
503
|
-
}, 8, ["auto-play", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
|
|
504
|
-
],
|
|
505
|
-
|
|
302
|
+
}, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
|
|
303
|
+
], 32),
|
|
304
|
+
createTextVNode(),
|
|
305
|
+
_ctx.showIndex ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.active) + " / " + toDisplayString(_ctx.images.length), 1)) : createCommentVNode("", true),
|
|
306
|
+
createTextVNode(),
|
|
506
307
|
_ctx.closeable ? (openBlock(), createElementBlock("view", {
|
|
507
308
|
key: 1,
|
|
508
309
|
class: "nut-imagepreview-close-icon",
|
|
509
|
-
onClick: _cache[
|
|
310
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleCloseIcon && _ctx.handleCloseIcon(...args)),
|
|
510
311
|
style: normalizeStyle(_ctx.styles)
|
|
511
312
|
}, [
|
|
512
313
|
createVNode(_component_nut_icon, mergeProps({ name: _ctx.closeIcon }, _ctx.$attrs, { color: "#ffffff" }), null, 16, ["name"])
|
|
513
314
|
], 4)) : createCommentVNode("", true)
|
|
514
315
|
]),
|
|
515
316
|
_: 1
|
|
516
|
-
}, 8, ["visible", "
|
|
317
|
+
}, 8, ["visible", "onClick"]);
|
|
517
318
|
}
|
|
518
|
-
var
|
|
519
|
-
|
|
520
|
-
constructor() {
|
|
521
|
-
this.show = false;
|
|
522
|
-
this.images = [];
|
|
523
|
-
this.initNo = 1;
|
|
524
|
-
this.paginationVisible = false;
|
|
525
|
-
this.paginationColor = "";
|
|
526
|
-
this.teleport = "body";
|
|
527
|
-
this.onClose = () => {
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
class ImagePreviewFunction {
|
|
532
|
-
constructor(_options) {
|
|
533
|
-
this.options = new ImagePreviewOptions();
|
|
534
|
-
const options = Object.assign(this.options, _options);
|
|
535
|
-
let elWarp = document.body;
|
|
536
|
-
const teleport = options.teleport;
|
|
537
|
-
if (teleport != "body") {
|
|
538
|
-
if (typeof teleport == "string") {
|
|
539
|
-
elWarp = document.querySelector(teleport);
|
|
540
|
-
} else {
|
|
541
|
-
elWarp = options.teleport;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
const root = document.createElement("view");
|
|
545
|
-
root.id = "imagepreview-" + new Date().getTime();
|
|
546
|
-
const Wrapper = {
|
|
547
|
-
setup() {
|
|
548
|
-
options.teleport = `#${root.id}`;
|
|
549
|
-
return () => {
|
|
550
|
-
return h(ImagePreview, options);
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
const instance = createVNode(Wrapper);
|
|
555
|
-
elWarp.appendChild(root);
|
|
556
|
-
render(instance, root);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
const _ImagePreview = (options) => {
|
|
560
|
-
return new ImagePreviewFunction(options);
|
|
561
|
-
};
|
|
562
|
-
_ImagePreview.install = (app) => {
|
|
563
|
-
app.use(ImagePreview);
|
|
564
|
-
app.config.globalProperties.$imagepreview = _ImagePreview;
|
|
565
|
-
};
|
|
566
|
-
export { ImagePreview, ImagePreviewOptions, _ImagePreview as default };
|
|
319
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
320
|
+
export { index_taro as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.2.
|
|
2
|
+
* @nutui/nutui v3.2.6-beta.1 Mon Oct 31 2022 19:38:22 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -63,5 +63,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
63
63
|
}), 128))
|
|
64
64
|
], 2);
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
export {
|
|
66
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
67
|
+
export { index_taro as default };
|