@nutui/nutui 3.1.12-beta.1 → 3.1.12
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 +27 -0
- package/dist/nutui.d.ts +1 -1
- package/dist/nutui.es.js +3219 -2562
- package/dist/nutui.umd.js +3292 -2565
- package/dist/packages/_es/ActionSheet.js +12 -13
- package/dist/packages/_es/Address.js +49 -63
- package/dist/packages/_es/Avatar.js +5 -4
- package/dist/packages/_es/BackTop.js +109 -72
- package/dist/packages/_es/Badge.js +5 -4
- package/dist/packages/_es/Barrage.js +57 -63
- package/dist/packages/_es/Button.js +6 -5
- package/dist/packages/_es/Calendar.js +18 -27
- package/dist/packages/_es/Card.js +8 -7
- package/dist/packages/_es/Cell.js +13 -5
- package/dist/packages/_es/CellGroup.js +14 -7
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +4 -9
- package/dist/packages/_es/CircleProgress.js +46 -142
- package/dist/packages/_es/Col.js +5 -4
- package/dist/packages/_es/Collapse.js +10 -35
- package/dist/packages/_es/CollapseItem.js +35 -80
- package/dist/packages/_es/CountDown.js +5 -7
- package/dist/packages/_es/CountUp.js +31 -34
- package/dist/packages/_es/DatePicker.js +219 -451
- package/dist/packages/_es/Dialog.js +98 -46
- package/dist/packages/_es/Divider.js +6 -5
- package/dist/packages/_es/Drag.js +50 -76
- package/dist/packages/_es/Elevator.js +52 -81
- package/dist/packages/_es/FixedNav.js +9 -8
- package/dist/packages/_es/Form.js +6 -5
- package/dist/packages/_es/FormItem.js +5 -4
- package/dist/packages/_es/Icon.js +40 -6
- package/dist/packages/_es/ImagePreview.js +158 -44
- package/dist/packages/_es/InfiniteLoading.js +109 -95
- package/dist/packages/_es/Input.js +21 -22
- package/dist/packages/_es/InputNumber.js +18 -24
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +14 -16
- package/dist/packages/_es/MenuItem.js +11 -9
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +26 -39
- package/dist/packages/_es/Notify.js +166 -30
- package/dist/packages/_es/NumberKeyboard.js +7 -9
- package/dist/packages/_es/OverLay.js +29 -22
- package/dist/packages/_es/Pagination.js +9 -8
- package/dist/packages/_es/Picker.js +447 -61
- package/dist/packages/_es/Popover.js +34 -161
- package/dist/packages/_es/Popup.js +77 -17
- package/dist/packages/_es/Price.js +7 -18
- package/dist/packages/_es/Progress.js +12 -23
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +31 -38
- package/dist/packages/_es/Rate.js +35 -17
- package/dist/packages/_es/Row.js +5 -4
- package/dist/packages/_es/SearchBar.js +5 -7
- package/dist/packages/_es/ShortPassword.js +59 -89
- package/dist/packages/_es/Signature.js +71 -70
- package/dist/packages/_es/Sku.js +43 -53
- package/dist/packages/_es/Step.js +8 -10
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +28 -43
- package/dist/packages/_es/Swiper.js +418 -17
- package/dist/packages/_es/SwiperItem.js +39 -14
- package/dist/packages/_es/Switch.js +32 -11
- package/dist/packages/_es/TabPane.js +5 -4
- package/dist/packages/_es/Tabbar.js +5 -4
- package/dist/packages/_es/TabbarItem.js +9 -8
- package/dist/packages/_es/Tabs.js +16 -22
- package/dist/packages/_es/Tag.js +6 -5
- package/dist/packages/_es/TextArea.js +12 -16
- package/dist/packages/_es/TimeDetail.js +5 -7
- package/dist/packages/_es/TimePannel.js +5 -7
- package/dist/packages/_es/TimeSelect.js +7 -12
- package/dist/packages/_es/Toast.js +178 -46
- package/dist/packages/_es/Uploader.js +149 -109
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +7 -58
- package/dist/packages/_es/index2.js +58 -43
- package/dist/packages/_es/index3.js +28 -411
- package/dist/packages/_es/plugin-vue_export-helper.js +13 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/cellgroup/index.scss +9 -0
- package/dist/packages/dialog/index.scss +17 -0
- package/dist/packages/drag/index.scss +4 -0
- package/dist/packages/fixednav/index.scss +6 -1
- package/dist/packages/formitem/index.scss +3 -0
- package/dist/packages/icon/index.scss +2 -1
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/popover/index.scss +2 -2
- package/dist/packages/rate/index.scss +1 -0
- package/dist/packages/textarea/index.scss +1 -0
- package/dist/packages/timedetail/index.scss +1 -2
- package/dist/packages/timeselect/index.scss +3 -0
- package/dist/packages/toast/index.scss +6 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/font/config.json +2 -1
- package/dist/styles/font/demo_index.html +26 -3
- package/dist/styles/font/iconfont.css +7 -3
- package/dist/styles/font/iconfont.js +31 -32
- package/dist/styles/font/iconfont.json +7 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +38 -38
- package/dist/styles/variables.scss +5 -1
- package/package.json +1 -1
- package/dist/packages/_es/commonProps.js +0 -30
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +0 -44
- package/dist/packages/_es/use-lock-scroll.js +0 -23
|
@@ -17,28 +17,29 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var
|
|
21
|
-
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
22
23
|
};
|
|
23
24
|
/*!
|
|
24
|
-
* @nutui/nutui v3.1.
|
|
25
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
25
26
|
* (c) 2021 @jdf2e.
|
|
26
27
|
* Released under the MIT License.
|
|
27
28
|
*/
|
|
28
|
-
import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle } from "vue";
|
|
29
|
+
import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, render, h } from "vue";
|
|
29
30
|
import { c as createComponent } from "./component.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import "./
|
|
31
|
+
import Popup, { popupProps } from "./Popup.js";
|
|
32
|
+
import Button from "./Button.js";
|
|
33
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
33
34
|
import "./OverLay.js";
|
|
34
|
-
import "./
|
|
35
|
+
import "./Icon.js";
|
|
35
36
|
import "./pxCheck.js";
|
|
36
37
|
const { componentName, create } = createComponent("dialog");
|
|
37
|
-
|
|
38
|
+
const _sfc_main = create({
|
|
38
39
|
inheritAttrs: false,
|
|
39
40
|
components: {
|
|
40
|
-
[
|
|
41
|
-
[
|
|
41
|
+
[Popup.name]: Popup,
|
|
42
|
+
[Button.name]: Button
|
|
42
43
|
},
|
|
43
44
|
props: __spreadProps(__spreadValues({}, popupProps), {
|
|
44
45
|
closeOnClickOverlay: {
|
|
@@ -85,37 +86,16 @@ var _sfc_main = create({
|
|
|
85
86
|
type: String,
|
|
86
87
|
default: "center"
|
|
87
88
|
},
|
|
88
|
-
onOk: {
|
|
89
|
-
type: Function,
|
|
90
|
-
default: null
|
|
91
|
-
},
|
|
92
|
-
onCancel: {
|
|
93
|
-
type: Function,
|
|
94
|
-
default: null
|
|
95
|
-
},
|
|
96
|
-
onClose: {
|
|
97
|
-
type: Function,
|
|
98
|
-
default: null
|
|
99
|
-
},
|
|
100
|
-
onClosed: {
|
|
101
|
-
type: Function,
|
|
102
|
-
default: null
|
|
103
|
-
},
|
|
104
89
|
closeOnPopstate: {
|
|
105
90
|
type: Boolean,
|
|
106
91
|
default: false
|
|
92
|
+
},
|
|
93
|
+
footerDirection: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "horizontal"
|
|
107
96
|
}
|
|
108
97
|
}),
|
|
109
|
-
emits: [
|
|
110
|
-
"update",
|
|
111
|
-
"update:visible",
|
|
112
|
-
"ok",
|
|
113
|
-
"cancel",
|
|
114
|
-
"open",
|
|
115
|
-
"opened",
|
|
116
|
-
"close",
|
|
117
|
-
"closed"
|
|
118
|
-
],
|
|
98
|
+
emits: ["update", "update:visible", "ok", "cancel", "open", "opened", "close", "closed"],
|
|
119
99
|
setup(props, { emit }) {
|
|
120
100
|
const showPopup = ref(props.visible);
|
|
121
101
|
onMounted(() => {
|
|
@@ -148,8 +128,8 @@ var _sfc_main = create({
|
|
|
148
128
|
}
|
|
149
129
|
};
|
|
150
130
|
const onOk = () => {
|
|
151
|
-
closed();
|
|
152
131
|
emit("ok");
|
|
132
|
+
closed();
|
|
153
133
|
};
|
|
154
134
|
return {
|
|
155
135
|
closed,
|
|
@@ -165,10 +145,6 @@ const _hoisted_1 = {
|
|
|
165
145
|
class: "nut-dialog__header"
|
|
166
146
|
};
|
|
167
147
|
const _hoisted_2 = ["innerHTML"];
|
|
168
|
-
const _hoisted_3 = {
|
|
169
|
-
key: 1,
|
|
170
|
-
class: "nut-dialog__footer"
|
|
171
|
-
};
|
|
172
148
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
173
149
|
const _component_nut_button = resolveComponent("nut-button");
|
|
174
150
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
@@ -200,7 +176,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
200
176
|
innerHTML: _ctx.content
|
|
201
177
|
}, null, 8, _hoisted_2))
|
|
202
178
|
], 4),
|
|
203
|
-
!_ctx.noFooter ? (openBlock(), createElementBlock("view",
|
|
179
|
+
!_ctx.noFooter ? (openBlock(), createElementBlock("view", {
|
|
180
|
+
key: 1,
|
|
181
|
+
class: normalizeClass(["nut-dialog__footer", { [_ctx.footerDirection]: _ctx.footerDirection }])
|
|
182
|
+
}, [
|
|
204
183
|
_ctx.$slots.footer ? renderSlot(_ctx.$slots, "footer", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
205
184
|
!_ctx.noCancelBtn ? (openBlock(), createBlock(_component_nut_button, {
|
|
206
185
|
key: 0,
|
|
@@ -229,11 +208,84 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
229
208
|
_: 1
|
|
230
209
|
}, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
231
210
|
], 64))
|
|
232
|
-
])) : createCommentVNode("", true)
|
|
211
|
+
], 2)) : createCommentVNode("", true)
|
|
233
212
|
], 2)
|
|
234
213
|
]),
|
|
235
214
|
_: 3
|
|
236
215
|
}, 8, ["teleport", "visible", "close-on-click-overlay", "lock-scroll", "onClickOverlay", "onClickCloseIcon"]);
|
|
237
216
|
}
|
|
238
|
-
_sfc_main
|
|
239
|
-
|
|
217
|
+
var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
218
|
+
class DialogOptions {
|
|
219
|
+
constructor() {
|
|
220
|
+
__publicField(this, "title", "");
|
|
221
|
+
__publicField(this, "content", "");
|
|
222
|
+
__publicField(this, "cancelText", "\u53D6\u6D88");
|
|
223
|
+
__publicField(this, "okText", "\u786E\u5B9A");
|
|
224
|
+
__publicField(this, "textAlign", "center");
|
|
225
|
+
__publicField(this, "teleport", "body");
|
|
226
|
+
__publicField(this, "onUpdate", (value) => {
|
|
227
|
+
});
|
|
228
|
+
__publicField(this, "onOk", () => {
|
|
229
|
+
});
|
|
230
|
+
__publicField(this, "onCancel", () => {
|
|
231
|
+
});
|
|
232
|
+
__publicField(this, "onClose", () => {
|
|
233
|
+
});
|
|
234
|
+
__publicField(this, "onClosed", () => {
|
|
235
|
+
});
|
|
236
|
+
__publicField(this, "visible", true);
|
|
237
|
+
__publicField(this, "noFooter", false);
|
|
238
|
+
__publicField(this, "noOkBtn", false);
|
|
239
|
+
__publicField(this, "noCancelBtn", false);
|
|
240
|
+
__publicField(this, "okBtnDisabled", false);
|
|
241
|
+
__publicField(this, "closeOnPopstate", false);
|
|
242
|
+
__publicField(this, "lockScroll", false);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
class DialogFunction {
|
|
246
|
+
constructor(_options) {
|
|
247
|
+
__publicField(this, "options", new DialogOptions());
|
|
248
|
+
__publicField(this, "close", () => {
|
|
249
|
+
});
|
|
250
|
+
__publicField(this, "setDefaultOptions", (options) => {
|
|
251
|
+
});
|
|
252
|
+
__publicField(this, "resetDefaultOptions", () => {
|
|
253
|
+
});
|
|
254
|
+
let options = Object.assign(this.options, _options);
|
|
255
|
+
let elWarp = document.body;
|
|
256
|
+
let teleport = options.teleport;
|
|
257
|
+
if (teleport != "body") {
|
|
258
|
+
if (typeof teleport == "string") {
|
|
259
|
+
elWarp = document.querySelector(teleport);
|
|
260
|
+
} else {
|
|
261
|
+
elWarp = options.teleport;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const root = document.createElement("view");
|
|
265
|
+
root.id = "dialog-" + new Date().getTime();
|
|
266
|
+
const Wrapper = {
|
|
267
|
+
setup() {
|
|
268
|
+
options.onUpdate = (val) => {
|
|
269
|
+
if (val == false) {
|
|
270
|
+
elWarp.removeChild(root);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
options.teleport = `#${root.id}`;
|
|
274
|
+
return () => {
|
|
275
|
+
return h(Dialog, options);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const instance = createVNode(Wrapper);
|
|
280
|
+
elWarp.appendChild(root);
|
|
281
|
+
render(instance, root);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const _Dialog = function(options) {
|
|
285
|
+
return new DialogFunction(options);
|
|
286
|
+
};
|
|
287
|
+
_Dialog.install = (app) => {
|
|
288
|
+
app.use(Dialog);
|
|
289
|
+
app.config.globalProperties.$dialog = _Dialog;
|
|
290
|
+
};
|
|
291
|
+
export { Dialog, DialogOptions, _Dialog as default };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { computed, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
8
9
|
const { componentName, create } = createComponent("divider");
|
|
9
|
-
|
|
10
|
+
const _sfc_main = create({
|
|
10
11
|
props: {
|
|
11
12
|
contentPosition: {
|
|
12
13
|
type: String,
|
|
@@ -38,11 +39,11 @@ var _sfc_main = create({
|
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
41
|
-
return openBlock(), createElementBlock("
|
|
42
|
+
return openBlock(), createElementBlock("div", {
|
|
42
43
|
class: normalizeClass(_ctx.classes)
|
|
43
44
|
}, [
|
|
44
45
|
renderSlot(_ctx.$slots, "default")
|
|
45
46
|
], 2);
|
|
46
47
|
}
|
|
47
|
-
_sfc_main
|
|
48
|
-
export {
|
|
48
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
49
|
+
export { index as default };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass,
|
|
6
|
+
import { ref, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { r as requestAniFrame } from "./raf.js";
|
|
9
|
-
import
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
10
|
const { componentName, create } = createComponent("drag");
|
|
11
|
-
|
|
11
|
+
const _sfc_main = create({
|
|
12
12
|
props: {
|
|
13
13
|
attract: {
|
|
14
14
|
type: Boolean,
|
|
@@ -40,13 +40,10 @@ var _sfc_main = create({
|
|
|
40
40
|
screenHeight: 0,
|
|
41
41
|
startTop: 0,
|
|
42
42
|
startLeft: 0,
|
|
43
|
-
initTop: 0,
|
|
44
43
|
nx: 0,
|
|
45
44
|
ny: 0,
|
|
46
45
|
xPum: 0,
|
|
47
46
|
yPum: 0,
|
|
48
|
-
top: 0,
|
|
49
|
-
left: 0,
|
|
50
47
|
position: { x: 0, y: 0 },
|
|
51
48
|
boundary: {
|
|
52
49
|
top: 0,
|
|
@@ -56,58 +53,54 @@ var _sfc_main = create({
|
|
|
56
53
|
}
|
|
57
54
|
});
|
|
58
55
|
const classes = computed(() => {
|
|
59
|
-
const prefixCls =
|
|
56
|
+
const prefixCls = componentName;
|
|
60
57
|
return {
|
|
61
58
|
[prefixCls]: true
|
|
62
59
|
};
|
|
63
60
|
});
|
|
64
|
-
const domElem = Taro.getSystemInfoSync();
|
|
65
61
|
function getInfo() {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}).exec();
|
|
72
|
-
console.log(domElem.windowWidth);
|
|
73
|
-
state.screenWidth = domElem.screenWidth;
|
|
74
|
-
state.screenHeight = domElem.screenHeight;
|
|
62
|
+
const domElem = document.documentElement;
|
|
63
|
+
state.elWidth = myDrag.value.offsetWidth;
|
|
64
|
+
state.elHeight = myDrag.value.offsetHeight;
|
|
65
|
+
state.screenWidth = domElem.clientWidth;
|
|
66
|
+
state.screenHeight = domElem.clientHeight;
|
|
75
67
|
}
|
|
76
|
-
function goLeft() {
|
|
68
|
+
function goLeft(target) {
|
|
77
69
|
if (state.boundary.left) {
|
|
78
|
-
if (+
|
|
79
|
-
|
|
70
|
+
if (+target.style.left.split("px")[0] > state.boundary.left) {
|
|
71
|
+
target.style.left = +target.style.left.split("px")[0] - 10 + "px";
|
|
80
72
|
requestAniFrame(() => {
|
|
81
|
-
goLeft();
|
|
73
|
+
goLeft(target);
|
|
82
74
|
});
|
|
83
75
|
} else {
|
|
84
|
-
|
|
76
|
+
target.style.left = `${state.boundary.left}px`;
|
|
85
77
|
}
|
|
86
78
|
} else {
|
|
87
|
-
if (+
|
|
88
|
-
|
|
79
|
+
if (+target.style.left.split("px")[0] > 10) {
|
|
80
|
+
target.style.left = +target.style.left.split("px")[0] - 10 + "px";
|
|
89
81
|
requestAniFrame(() => {
|
|
90
|
-
goLeft();
|
|
82
|
+
goLeft(target);
|
|
91
83
|
});
|
|
92
84
|
} else {
|
|
93
|
-
|
|
85
|
+
target.style.left = "0px";
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
}
|
|
97
|
-
function goRight(rightLocation) {
|
|
98
|
-
if (rightLocation - parseInt(
|
|
99
|
-
|
|
89
|
+
function goRight(target, rightLocation) {
|
|
90
|
+
if (rightLocation - parseInt(target.style.left.split("px")[0]) > 10) {
|
|
91
|
+
target.style.left = parseInt(target.style.left.split("px")[0]) + 10 + "px";
|
|
100
92
|
requestAniFrame(() => {
|
|
101
|
-
goRight(rightLocation);
|
|
93
|
+
goRight(target, rightLocation);
|
|
102
94
|
});
|
|
103
95
|
} else {
|
|
104
|
-
|
|
96
|
+
target.style.left = rightLocation + "px";
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
99
|
function touchMove(e) {
|
|
108
100
|
e.preventDefault();
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
const target = e.currentTarget;
|
|
102
|
+
if (e.targetTouches.length === 1) {
|
|
103
|
+
const touch = e.targetTouches[0];
|
|
111
104
|
state.nx = touch.clientX - state.position.x;
|
|
112
105
|
state.ny = touch.clientY - state.position.y;
|
|
113
106
|
state.xPum = state.startLeft + state.nx;
|
|
@@ -124,14 +117,15 @@ var _sfc_main = create({
|
|
|
124
117
|
state.yPum = state.screenHeight - state.elHeight - state.boundary.bottom;
|
|
125
118
|
}
|
|
126
119
|
if (props.direction != "y") {
|
|
127
|
-
|
|
120
|
+
target.style.left = state.xPum + "px";
|
|
128
121
|
}
|
|
129
122
|
if (props.direction != "x") {
|
|
130
|
-
|
|
123
|
+
target.style.top = state.yPum + "px";
|
|
131
124
|
}
|
|
132
125
|
}
|
|
133
126
|
}
|
|
134
127
|
function touchEnd(e) {
|
|
128
|
+
const target = e.currentTarget;
|
|
135
129
|
const touch = e.changedTouches[0];
|
|
136
130
|
let currX = touch.clientX;
|
|
137
131
|
const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
|
|
@@ -145,47 +139,33 @@ var _sfc_main = create({
|
|
|
145
139
|
if (props.direction != "y" && props.attract) {
|
|
146
140
|
if (currX < state.screenWidth / 2) {
|
|
147
141
|
requestAniFrame(() => {
|
|
148
|
-
goLeft();
|
|
142
|
+
goLeft(target);
|
|
149
143
|
});
|
|
150
144
|
} else {
|
|
151
145
|
requestAniFrame(() => {
|
|
152
|
-
goRight(rightLocation);
|
|
146
|
+
goRight(target, rightLocation);
|
|
153
147
|
});
|
|
154
148
|
}
|
|
155
149
|
}
|
|
156
|
-
if (props.direction
|
|
157
|
-
|
|
150
|
+
if (props.direction != "x") {
|
|
151
|
+
target.style.top = state.yPum + "px";
|
|
158
152
|
}
|
|
159
153
|
}
|
|
160
154
|
function touchStart(e) {
|
|
161
|
-
|
|
162
|
-
const query = Taro.createSelectorQuery();
|
|
163
|
-
let id = (_a = e == null ? void 0 : e.mpEvent) == null ? void 0 : _a.currentTarget.id;
|
|
164
|
-
let offsetTop = (_b = e == null ? void 0 : e.currentTarget) == null ? void 0 : _b.offsetTop;
|
|
165
|
-
let offsetLeft = (_c = e == null ? void 0 : e.currentTarget) == null ? void 0 : _c.offsetLeft;
|
|
155
|
+
const target = e.currentTarget;
|
|
166
156
|
const touches = e.touches[0];
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
rec.forEach((element) => {
|
|
171
|
-
if (id && id == element.id) {
|
|
172
|
-
state.startTop = element.top - offsetTop;
|
|
173
|
-
state.startLeft = element.left - offsetLeft;
|
|
174
|
-
} else if (mobileTop) {
|
|
175
|
-
state.startTop = Number(mobileTop.slice(0, -2));
|
|
176
|
-
state.startLeft = Number(mobileLeft.slice(0, -2));
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}).exec();
|
|
157
|
+
const touch = e.targetTouches[0];
|
|
158
|
+
state.startTop = target.offsetTop;
|
|
159
|
+
state.startLeft = target.offsetLeft;
|
|
180
160
|
state.position.x = touches.clientX;
|
|
181
161
|
state.position.y = touches.clientY;
|
|
162
|
+
state.nx = touch.clientX - state.position.x;
|
|
163
|
+
state.ny = touch.clientY - state.position.y;
|
|
164
|
+
state.xPum = state.startLeft + state.nx;
|
|
165
|
+
state.yPum = state.startTop + state.ny;
|
|
182
166
|
}
|
|
183
167
|
onMounted(() => {
|
|
184
|
-
|
|
185
|
-
getInfo();
|
|
186
|
-
}, 200);
|
|
187
|
-
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
188
|
-
});
|
|
168
|
+
getInfo();
|
|
189
169
|
state.boundary = props.boundary;
|
|
190
170
|
});
|
|
191
171
|
onActivated(() => {
|
|
@@ -204,26 +184,20 @@ var _sfc_main = create({
|
|
|
204
184
|
myDrag,
|
|
205
185
|
touchStart,
|
|
206
186
|
touchMove,
|
|
207
|
-
touchEnd
|
|
208
|
-
state
|
|
187
|
+
touchEnd
|
|
209
188
|
};
|
|
210
189
|
}
|
|
211
190
|
});
|
|
212
191
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
213
192
|
return openBlock(), createElementBlock("view", {
|
|
214
|
-
class: normalizeClass(
|
|
193
|
+
class: normalizeClass(_ctx.classes),
|
|
215
194
|
ref: "myDrag",
|
|
216
195
|
onTouchstart: _cache[0] || (_cache[0] = ($event) => _ctx.touchStart($event)),
|
|
217
|
-
onTouchmove: _cache[1] || (_cache[1] =
|
|
218
|
-
|
|
219
|
-
style: normalizeStyle({
|
|
220
|
-
transform: ` translate(${_ctx.state.left + "px"}, ${_ctx.state.top + "px"})`,
|
|
221
|
-
top: _ctx.state.top + "px",
|
|
222
|
-
left: _ctx.state.left + "px"
|
|
223
|
-
})
|
|
196
|
+
onTouchmove: _cache[1] || (_cache[1] = ($event) => _ctx.touchMove($event)),
|
|
197
|
+
onTouchend: _cache[2] || (_cache[2] = ($event) => _ctx.touchEnd($event))
|
|
224
198
|
}, [
|
|
225
199
|
renderSlot(_ctx.$slots, "default")
|
|
226
|
-
],
|
|
200
|
+
], 34);
|
|
227
201
|
}
|
|
228
|
-
_sfc_main
|
|
229
|
-
export {
|
|
202
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
203
|
+
export { index as default };
|