@nutui/nutui 3.1.18-beta.0 → 3.1.19-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/LICENSE +1 -1
- package/README.md +6 -0
- package/dist/nutui.d.ts +39 -36
- package/dist/nutui.es.js +13149 -11288
- package/dist/nutui.umd.js +13156 -11381
- package/dist/packages/_es/ActionSheet.js +13 -19
- package/dist/packages/_es/Address.js +70 -55
- package/dist/packages/_es/Audio.js +13 -13
- package/dist/packages/_es/AudioOperate.js +125 -0
- package/dist/packages/_es/Avatar.js +4 -4
- package/dist/packages/_es/BackTop.js +69 -108
- package/dist/packages/_es/Badge.js +4 -4
- package/dist/packages/_es/Barrage.js +63 -56
- package/dist/packages/_es/Button.js +3 -3
- package/dist/packages/_es/Calendar.js +30 -702
- package/dist/packages/_es/CalendarItem.js +10 -0
- package/dist/packages/_es/Card.js +7 -6
- package/dist/packages/_es/Cascader.js +8 -8
- package/dist/packages/_es/Cell.js +27 -27
- package/dist/packages/_es/CellGroup.js +2 -2
- package/dist/packages/_es/Checkbox.js +4 -4
- package/dist/packages/_es/CheckboxGroup.js +3 -3
- package/dist/packages/_es/CircleProgress.js +150 -41
- package/dist/packages/_es/Col.js +2 -2
- package/dist/packages/_es/Collapse.js +35 -9
- package/dist/packages/_es/CollapseItem.js +79 -38
- package/dist/packages/_es/CountDown.js +8 -6
- package/dist/packages/_es/CountUp.js +31 -30
- package/dist/packages/_es/DatePicker.js +81 -44
- package/dist/packages/_es/Dialog.js +7 -83
- package/dist/packages/_es/Divider.js +5 -5
- package/dist/packages/_es/Drag.js +93 -55
- package/dist/packages/_es/Elevator.js +75 -50
- package/dist/packages/_es/Empty.js +4 -4
- package/dist/packages/_es/FixedNav.js +6 -6
- package/dist/packages/_es/Form.js +11 -9
- package/dist/packages/_es/FormItem.js +9 -6
- package/dist/packages/_es/Grid.js +2 -2
- package/dist/packages/_es/GridItem.js +9 -27
- package/dist/packages/_es/Icon.js +2 -2
- package/dist/packages/_es/ImagePreview.js +14 -83
- package/dist/packages/_es/Indicator.js +4 -4
- package/dist/packages/_es/InfiniteLoading.js +94 -108
- package/dist/packages/_es/Input.js +297 -73
- package/dist/packages/_es/InputNumber.js +24 -17
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/List.js +131 -0
- package/dist/packages/_es/Menu.js +16 -13
- package/dist/packages/_es/MenuItem.js +8 -8
- package/dist/packages/_es/Navbar.js +17 -12
- package/dist/packages/_es/NoticeBar.js +47 -39
- package/dist/packages/_es/Notify.js +28 -163
- package/dist/packages/_es/NumberKeyboard.js +4 -4
- package/dist/packages/_es/OldPicker.js +486 -0
- package/dist/packages/_es/OverLay.js +6 -26
- package/dist/packages/_es/Pagination.js +8 -8
- package/dist/packages/_es/Picker.js +192 -163
- package/dist/packages/_es/Popover.js +155 -30
- package/dist/packages/_es/Popup.js +7 -70
- package/dist/packages/_es/Price.js +18 -6
- package/dist/packages/_es/Progress.js +29 -27
- package/dist/packages/_es/PullRefresh.js +363 -0
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +169 -46
- package/dist/packages/_es/Rate.js +17 -20
- package/dist/packages/_es/Row.js +2 -2
- package/dist/packages/_es/SearchBar.js +9 -7
- package/dist/packages/_es/ShortPassword.js +90 -68
- package/dist/packages/_es/SideNavBar.js +6 -17
- package/dist/packages/_es/SideNavBarItem.js +2 -2
- package/dist/packages/_es/Signature.js +70 -70
- package/dist/packages/_es/Skeleton.js +9 -12
- package/dist/packages/_es/Sku.js +40 -31
- package/dist/packages/_es/Step.js +28 -12
- package/dist/packages/_es/Steps.js +8 -3
- package/dist/packages/_es/Sticky.js +29 -24
- package/dist/packages/_es/SubSideNavBar.js +2 -2
- package/dist/packages/_es/Swipe.js +40 -27
- package/dist/packages/_es/Swiper.js +32 -14
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +4 -4
- package/dist/packages/_es/TabPane.js +2 -2
- package/dist/packages/_es/Tabbar.js +4 -4
- package/dist/packages/_es/TabbarItem.js +28 -23
- package/dist/packages/_es/Table.js +14 -14
- package/dist/packages/_es/Tabs.js +19 -15
- package/dist/packages/_es/Tag.js +14 -8
- package/dist/packages/_es/TextArea.js +49 -15
- package/dist/packages/_es/TimeDetail.js +5 -4
- package/dist/packages/_es/TimePannel.js +4 -4
- package/dist/packages/_es/TimeSelect.js +9 -8
- package/dist/packages/_es/Toast.js +42 -171
- package/dist/packages/_es/Uploader.js +108 -139
- package/dist/packages/_es/Video.js +14 -10
- package/dist/packages/_es/common.js +2 -2
- package/dist/packages/_es/component.js +2 -2
- package/dist/packages/_es/index.js +45 -7
- package/dist/packages/_es/index.taro.js +719 -0
- package/dist/packages/_es/index2.js +2 -2
- package/dist/packages/_es/index3.js +57 -29
- package/dist/packages/_es/index4.js +414 -57
- package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
- package/dist/packages/_es/pxCheck.js +2 -2
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +2 -2
- package/dist/packages/badge/index.scss +11 -13
- package/dist/packages/button/index.scss +1 -0
- package/dist/packages/calendar/index.scss +9 -4
- package/dist/packages/calendaritem/index.scss +0 -207
- package/dist/packages/cell/index.scss +6 -6
- package/dist/packages/checkbox/index.scss +4 -3
- package/dist/packages/collapseitem/index.scss +21 -11
- package/dist/packages/countdown/index.scss +3 -1
- package/dist/packages/divider/index.scss +8 -8
- package/dist/packages/elevator/index.scss +36 -36
- package/dist/packages/formitem/index.scss +15 -8
- package/dist/packages/indicator/index.scss +1 -1
- package/dist/packages/input/index.scss +70 -24
- package/dist/packages/inputnumber/index.scss +4 -2
- package/dist/packages/list/index.scss +24 -0
- package/dist/packages/menu/index.scss +3 -3
- package/dist/packages/navbar/index.scss +28 -8
- package/dist/packages/noticebar/index.scss +7 -8
- package/dist/packages/notify/index.scss +9 -0
- package/dist/packages/numberkeyboard/index.scss +22 -21
- package/dist/packages/oldpicker/index.scss +131 -0
- package/dist/packages/picker/index.scss +38 -32
- package/dist/packages/progress/index.scss +6 -5
- package/dist/packages/radio/index.scss +7 -6
- package/dist/packages/range/index.scss +109 -2
- package/dist/packages/searchbar/index.scss +7 -7
- package/dist/packages/sidenavbaritem/index.scss +5 -5
- package/dist/packages/step/index.scss +29 -29
- package/dist/packages/subsidenavbar/index.scss +10 -8
- package/dist/packages/tabbaritem/index.scss +15 -0
- package/dist/packages/timedetail/index.scss +13 -13
- package/dist/packages/timepannel/index.scss +7 -7
- package/dist/packages/timeselect/index.scss +3 -3
- package/dist/packages/uploader/index.scss +6 -6
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +64 -62
- package/dist/styles/themes/jdt.scss +91 -0
- package/dist/styles/variables-jdt.scss +728 -0
- package/dist/styles/variables.scss +250 -44
- package/package.json +2 -1
- package/dist/packages/_es/raf.js +0 -19
- package/dist/styles/themes/jdd.scss +0 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { ref, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives,
|
|
6
|
+
import { ref, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives, vModelText, createCommentVNode, Fragment, renderList } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
+
import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
|
|
8
9
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
10
|
const { create } = createComponent("shortpassword");
|
|
10
11
|
const _sfc_main = create({
|
|
@@ -44,10 +45,6 @@ const _sfc_main = create({
|
|
|
44
45
|
length: {
|
|
45
46
|
type: [String, Number],
|
|
46
47
|
default: 6
|
|
47
|
-
},
|
|
48
|
-
isWrapTeleport: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: true
|
|
51
48
|
}
|
|
52
49
|
},
|
|
53
50
|
emits: ["update:modelValue", "update:visible", "complete", "change", "ok", "tips", "close", "cancel"],
|
|
@@ -56,21 +53,42 @@ const _sfc_main = create({
|
|
|
56
53
|
const realpwd = ref();
|
|
57
54
|
const comLen = computed(() => range(Number(props.length)));
|
|
58
55
|
const show = ref(props.visible);
|
|
56
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
57
|
+
const randRef = ref(refRandomId);
|
|
58
|
+
const isWx = ref(false);
|
|
59
59
|
function sureClick() {
|
|
60
60
|
emit("ok", realInput.value);
|
|
61
61
|
}
|
|
62
62
|
function focus() {
|
|
63
|
-
|
|
63
|
+
let dom = "";
|
|
64
|
+
if (isWx.value) {
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
if (!document.getElementById("nut-input-real-taro-" + randRef.value))
|
|
67
|
+
return;
|
|
68
|
+
dom = document.getElementById("nut-input-real-taro-" + randRef.value);
|
|
69
|
+
if (!dom)
|
|
70
|
+
return;
|
|
71
|
+
dom.focus();
|
|
72
|
+
}, 150);
|
|
73
|
+
} else {
|
|
74
|
+
dom = document.getElementsByClassName("nut-input-real")[0];
|
|
75
|
+
let h = dom.children[0];
|
|
76
|
+
h.focus();
|
|
77
|
+
}
|
|
64
78
|
}
|
|
65
79
|
watch(() => props.visible, (value) => {
|
|
66
80
|
show.value = value;
|
|
81
|
+
if (value) {
|
|
82
|
+
randRef.value = Math.random().toString(36).slice(-8);
|
|
83
|
+
if (Taro.getEnv() === "WEB") {
|
|
84
|
+
isWx.value = false;
|
|
85
|
+
} else {
|
|
86
|
+
isWx.value = true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
67
89
|
});
|
|
68
90
|
watch(() => props.modelValue, (value) => {
|
|
69
91
|
realInput.value = value;
|
|
70
|
-
emit("update:modelValue", value);
|
|
71
|
-
}, {
|
|
72
|
-
deep: true,
|
|
73
|
-
immediate: true
|
|
74
92
|
});
|
|
75
93
|
function changeValue(e) {
|
|
76
94
|
const input = e.target;
|
|
@@ -99,54 +117,46 @@ const _sfc_main = create({
|
|
|
99
117
|
function onTips() {
|
|
100
118
|
emit("tips");
|
|
101
119
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
120
|
+
onMounted(() => {
|
|
121
|
+
eventCenter.once(getCurrentInstance().router.onReady, () => {
|
|
122
|
+
});
|
|
123
|
+
if (Taro.getEnv() === "WEB") {
|
|
124
|
+
isWx.value = false;
|
|
125
|
+
} else {
|
|
126
|
+
isWx.value = true;
|
|
110
127
|
}
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
opacity: 0,
|
|
114
|
-
zindex: 10
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
128
|
+
});
|
|
118
129
|
return {
|
|
119
130
|
comLen,
|
|
120
131
|
sureClick,
|
|
121
132
|
realInput,
|
|
122
133
|
realpwd,
|
|
123
|
-
focus,
|
|
124
134
|
range,
|
|
125
135
|
changeValue,
|
|
126
136
|
close,
|
|
127
137
|
onTips,
|
|
138
|
+
focus,
|
|
128
139
|
show,
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
closeIcon,
|
|
141
|
+
isWx,
|
|
142
|
+
refRandomId,
|
|
143
|
+
randRef
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
146
|
});
|
|
134
147
|
const _hoisted_1 = { class: "nut-shortpsd-title" };
|
|
135
|
-
const _hoisted_2 = { class: "nut-
|
|
136
|
-
const _hoisted_3 =
|
|
137
|
-
const _hoisted_4 =
|
|
138
|
-
const _hoisted_5 = {
|
|
148
|
+
const _hoisted_2 = { class: "nut-shortpsdWx-subtitle" };
|
|
149
|
+
const _hoisted_3 = ["id", "maxlength"];
|
|
150
|
+
const _hoisted_4 = { class: "nut-input-w" };
|
|
151
|
+
const _hoisted_5 = /* @__PURE__ */ createElementVNode("view", { class: "nut-input-site" }, null, -1);
|
|
152
|
+
const _hoisted_6 = {
|
|
139
153
|
key: 0,
|
|
140
154
|
class: "nut-shortpsd-icon"
|
|
141
155
|
};
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
const _hoisted_8 = {
|
|
145
|
-
key: 0,
|
|
146
|
-
class: "nut-shortpsd-forget"
|
|
147
|
-
};
|
|
156
|
+
const _hoisted_7 = { class: "nut-shortpsd-message" };
|
|
157
|
+
const _hoisted_8 = { class: "nut-shortpsd-error" };
|
|
148
158
|
const _hoisted_9 = {
|
|
149
|
-
key:
|
|
159
|
+
key: 1,
|
|
150
160
|
class: "nut-shortpsd-footer"
|
|
151
161
|
};
|
|
152
162
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -160,70 +170,82 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
160
170
|
textAlign: "center"
|
|
161
171
|
},
|
|
162
172
|
visible: _ctx.show,
|
|
163
|
-
"onUpdate:visible": _cache[
|
|
173
|
+
"onUpdate:visible": _cache[8] || (_cache[8] = ($event) => _ctx.show = $event),
|
|
164
174
|
closeable: true,
|
|
165
175
|
onClickCloseIcon: _ctx.closeIcon,
|
|
166
176
|
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
167
|
-
onClickOverlay: _ctx.close
|
|
168
|
-
isWrapTeleport: _ctx.isWrapTeleport
|
|
177
|
+
onClickOverlay: _ctx.close
|
|
169
178
|
}, {
|
|
170
179
|
default: withCtx(() => [
|
|
171
180
|
createElementVNode("view", _hoisted_1, toDisplayString(_ctx.title), 1),
|
|
172
181
|
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.desc), 1),
|
|
173
|
-
|
|
174
|
-
|
|
182
|
+
_ctx.isWx && _ctx.visible ? withDirectives((openBlock(), createElementBlock("input", {
|
|
183
|
+
key: 0,
|
|
184
|
+
class: "nut-input-real-taro",
|
|
185
|
+
id: "nut-input-real-taro-" + _ctx.randRef,
|
|
186
|
+
type: "number",
|
|
187
|
+
maxlength: _ctx.length,
|
|
188
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.realInput = $event),
|
|
189
|
+
onInput: _cache[1] || (_cache[1] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
|
|
190
|
+
}, null, 40, _hoisted_3)), [
|
|
191
|
+
[vModelText, _ctx.realInput]
|
|
192
|
+
]) : createCommentVNode("", true),
|
|
193
|
+
createElementVNode("view", _hoisted_4, [
|
|
194
|
+
!_ctx.isWx ? withDirectives((openBlock(), createElementBlock("input", {
|
|
195
|
+
key: 0,
|
|
175
196
|
ref: "realpwd",
|
|
176
197
|
class: "nut-input-real",
|
|
177
198
|
type: "number",
|
|
178
199
|
maxlength: "6",
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}, null, 36), [
|
|
200
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.realInput = $event),
|
|
201
|
+
onInput: _cache[3] || (_cache[3] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
|
|
202
|
+
}, null, 544)), [
|
|
183
203
|
[vModelText, _ctx.realInput]
|
|
184
|
-
]),
|
|
185
|
-
|
|
204
|
+
]) : createCommentVNode("", true),
|
|
205
|
+
_hoisted_5,
|
|
186
206
|
createElementVNode("view", {
|
|
187
|
-
class: "nut-shortpsd-fake",
|
|
188
|
-
onClick: _cache[
|
|
207
|
+
class: "nut-shortpsd-fake-taro",
|
|
208
|
+
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.focus && _ctx.focus(...args))
|
|
189
209
|
}, [
|
|
190
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen,
|
|
210
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen, index) => {
|
|
191
211
|
return openBlock(), createElementBlock("view", {
|
|
192
212
|
class: "nut-shortpsd-li",
|
|
193
|
-
key:
|
|
213
|
+
key: index
|
|
194
214
|
}, [
|
|
195
|
-
String(_ctx.realInput).length >
|
|
215
|
+
String(_ctx.realInput).length > index ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true)
|
|
196
216
|
]);
|
|
197
217
|
}), 128))
|
|
198
218
|
])
|
|
199
219
|
]),
|
|
200
|
-
createElementVNode("view",
|
|
201
|
-
createElementVNode("view",
|
|
202
|
-
_ctx.tips ? (openBlock(), createElementBlock("view",
|
|
220
|
+
createElementVNode("view", _hoisted_7, [
|
|
221
|
+
createElementVNode("view", _hoisted_8, toDisplayString(_ctx.errorMsg), 1),
|
|
222
|
+
_ctx.tips ? (openBlock(), createElementBlock("view", {
|
|
223
|
+
key: 0,
|
|
224
|
+
class: "nut-shortpsd-forget",
|
|
225
|
+
onClick: _cache[5] || (_cache[5] = (...args) => _ctx.onTips && _ctx.onTips(...args))
|
|
226
|
+
}, [
|
|
203
227
|
createVNode(_component_nut_icon, {
|
|
204
228
|
class: "icon",
|
|
205
229
|
size: "11px",
|
|
206
230
|
name: "tips"
|
|
207
231
|
}),
|
|
208
|
-
createElementVNode("view",
|
|
209
|
-
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onTips && _ctx.onTips(...args))
|
|
210
|
-
}, toDisplayString(_ctx.tips), 1)
|
|
232
|
+
createElementVNode("view", null, toDisplayString(_ctx.tips), 1)
|
|
211
233
|
])) : createCommentVNode("", true)
|
|
212
234
|
]),
|
|
213
235
|
!_ctx.noButton ? (openBlock(), createElementBlock("view", _hoisted_9, [
|
|
214
236
|
createElementVNode("view", {
|
|
215
237
|
class: "nut-shortpsd-cancle",
|
|
216
|
-
onClick: _cache[
|
|
238
|
+
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.close && _ctx.close(...args))
|
|
217
239
|
}, "\u53D6\u6D88"),
|
|
218
240
|
createElementVNode("view", {
|
|
219
241
|
class: "nut-shortpsd-sure",
|
|
220
|
-
onClick: _cache[
|
|
242
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.sureClick && _ctx.sureClick(...args))
|
|
221
243
|
}, "\u786E\u8BA4")
|
|
222
244
|
])) : createCommentVNode("", true)
|
|
223
245
|
]),
|
|
224
246
|
_: 1
|
|
225
|
-
}, 8, ["visible", "onClickCloseIcon", "close-on-click-overlay", "onClickOverlay"
|
|
247
|
+
}, 8, ["visible", "onClickCloseIcon", "close-on-click-overlay", "onClickOverlay"])
|
|
226
248
|
]);
|
|
227
249
|
}
|
|
228
|
-
var
|
|
229
|
-
export {
|
|
250
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
251
|
+
export { index_taro as default };
|
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
22
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
25
|
import { ref, reactive, computed, onMounted, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot } from "vue";
|
|
@@ -37,8 +37,7 @@ const _sfc_main = create({
|
|
|
37
37
|
setup: (props, context) => {
|
|
38
38
|
const list = ref(null);
|
|
39
39
|
const state = reactive({
|
|
40
|
-
count: 1
|
|
41
|
-
observer: null
|
|
40
|
+
count: 1
|
|
42
41
|
});
|
|
43
42
|
const classes = computed(() => {
|
|
44
43
|
const prefixCls = componentName;
|
|
@@ -58,7 +57,7 @@ const _sfc_main = create({
|
|
|
58
57
|
};
|
|
59
58
|
const handleSlots = () => {
|
|
60
59
|
let childNodes = list.value.childNodes;
|
|
61
|
-
if (childNodes.length) {
|
|
60
|
+
if (childNodes && childNodes.length) {
|
|
62
61
|
childNodes = Array.from(childNodes).filter((item) => item.nodeType !== 3).map((item) => {
|
|
63
62
|
return item;
|
|
64
63
|
});
|
|
@@ -67,16 +66,6 @@ const _sfc_main = create({
|
|
|
67
66
|
};
|
|
68
67
|
onMounted(() => {
|
|
69
68
|
handleSlots();
|
|
70
|
-
state.observer = new MutationObserver(function() {
|
|
71
|
-
state.count = 1;
|
|
72
|
-
handleSlots();
|
|
73
|
-
});
|
|
74
|
-
state.observer.observe(list.value, {
|
|
75
|
-
attributes: false,
|
|
76
|
-
childList: true,
|
|
77
|
-
characterData: false,
|
|
78
|
-
subtree: false
|
|
79
|
-
});
|
|
80
69
|
});
|
|
81
70
|
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
82
71
|
list,
|
|
@@ -100,5 +89,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
100
89
|
])
|
|
101
90
|
], 2);
|
|
102
91
|
}
|
|
103
|
-
var
|
|
104
|
-
export {
|
|
92
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
93
|
+
export { index_taro as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { computed, openBlock, createElementBlock, withModifiers, createElementVNode, toDisplayString } from "vue";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import Taro from "@tarojs/taro";
|
|
7
|
+
import { computed, reactive, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
|
|
7
8
|
import { c as createComponent } from "./component.js";
|
|
8
9
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
10
|
const { componentName, create } = createComponent("signature");
|
|
@@ -33,8 +34,6 @@ const _sfc_main = create({
|
|
|
33
34
|
components: {},
|
|
34
35
|
emits: ["confirm", "clear"],
|
|
35
36
|
setup(props, { emit }) {
|
|
36
|
-
const canvas = ref(null);
|
|
37
|
-
const wrap = ref(null);
|
|
38
37
|
const classes = computed(() => {
|
|
39
38
|
const prefixCls = componentName;
|
|
40
39
|
return {
|
|
@@ -43,125 +42,126 @@ const _sfc_main = create({
|
|
|
43
42
|
};
|
|
44
43
|
});
|
|
45
44
|
const state = reactive({
|
|
45
|
+
canvas: null,
|
|
46
46
|
canvasHeight: 0,
|
|
47
47
|
canvasWidth: 0,
|
|
48
|
-
ctx: null
|
|
49
|
-
isSupportTouch: "ontouchstart" in window,
|
|
50
|
-
events: "ontouchstart" in window ? ["touchstart", "touchmove", "touchend", "touchleave"] : ["mousedown", "mousemove", "mouseup", "mouseleave"]
|
|
48
|
+
ctx: null
|
|
51
49
|
});
|
|
52
|
-
const isCanvasSupported = () => {
|
|
53
|
-
let elem = document.createElement("canvas");
|
|
54
|
-
return !!(elem.getContext && elem.getContext("2d"));
|
|
55
|
-
};
|
|
56
|
-
const addEvent = () => {
|
|
57
|
-
canvas.value.addEventListener(state.events[0], startEventHandler, false);
|
|
58
|
-
};
|
|
59
50
|
const startEventHandler = (event) => {
|
|
60
51
|
event.preventDefault();
|
|
61
52
|
state.ctx.beginPath();
|
|
62
53
|
state.ctx.lineWidth = props.lineWidth;
|
|
63
54
|
state.ctx.strokeStyle = props.strokeStyle;
|
|
64
|
-
canvas.value.addEventListener(state.events[1], moveEventHandler, false);
|
|
65
|
-
canvas.value.addEventListener(state.events[2], endEventHandler, false);
|
|
66
|
-
canvas.value.addEventListener(state.events[3], leaveEventHandler, false);
|
|
67
55
|
};
|
|
68
56
|
const moveEventHandler = (event) => {
|
|
69
57
|
event.preventDefault();
|
|
70
|
-
let evt =
|
|
71
|
-
let
|
|
72
|
-
let
|
|
73
|
-
let mouseY = evt.clientY - coverPos.top;
|
|
58
|
+
let evt = event.changedTouches[0];
|
|
59
|
+
let mouseX = evt.x;
|
|
60
|
+
let mouseY = evt.y;
|
|
74
61
|
state.ctx.lineTo(mouseX, mouseY);
|
|
75
62
|
state.ctx.stroke();
|
|
76
63
|
};
|
|
77
64
|
const endEventHandler = (event) => {
|
|
78
65
|
event.preventDefault();
|
|
79
|
-
canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
|
|
80
|
-
canvas.value.removeEventListener(state.events[2], endEventHandler, false);
|
|
81
66
|
};
|
|
82
67
|
const leaveEventHandler = (event) => {
|
|
83
68
|
event.preventDefault();
|
|
84
|
-
canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
|
|
85
|
-
canvas.value.removeEventListener(state.events[2], endEventHandler, false);
|
|
86
69
|
};
|
|
87
70
|
const clear = () => {
|
|
88
|
-
canvas.value.addEventListener(state.events[2], endEventHandler, false);
|
|
89
71
|
state.ctx.clearRect(0, 0, state.canvasWidth, state.canvasHeight);
|
|
90
72
|
state.ctx.closePath();
|
|
91
73
|
emit("clear");
|
|
92
74
|
};
|
|
93
75
|
const confirm = () => {
|
|
94
|
-
onSave(
|
|
76
|
+
onSave();
|
|
95
77
|
};
|
|
96
|
-
const onSave = (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
case "png":
|
|
100
|
-
dataurl = canvas2.toDataURL("image/png");
|
|
101
|
-
break;
|
|
102
|
-
case "jpg":
|
|
103
|
-
dataurl = canvas2.toDataURL("image/jpeg", 0.8);
|
|
104
|
-
break;
|
|
78
|
+
const onSave = () => {
|
|
79
|
+
if (!state.canvas) {
|
|
80
|
+
return;
|
|
105
81
|
}
|
|
106
|
-
|
|
107
|
-
|
|
82
|
+
Taro.createSelectorQuery().select("#spcanvas").fields({
|
|
83
|
+
node: true,
|
|
84
|
+
size: true
|
|
85
|
+
}).exec(async (res) => {
|
|
86
|
+
Taro.canvasToTempFilePath({
|
|
87
|
+
canvas: res[0].node,
|
|
88
|
+
fileType: props.type
|
|
89
|
+
}).then((res2) => {
|
|
90
|
+
emit("confirm", res2.tempFilePath);
|
|
91
|
+
}).catch((e) => {
|
|
92
|
+
emit("confirm", e);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
108
95
|
};
|
|
109
96
|
onMounted(() => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
Taro.createSelectorQuery().select("#spcanvas").fields({
|
|
99
|
+
node: true,
|
|
100
|
+
size: true
|
|
101
|
+
}, function(res) {
|
|
102
|
+
const canvas = res.node;
|
|
103
|
+
const ctx = canvas.getContext("2d");
|
|
104
|
+
state.canvas = canvas;
|
|
105
|
+
state.ctx = ctx;
|
|
106
|
+
state.canvasWidth = res.width;
|
|
107
|
+
state.canvasHeight = res.height;
|
|
108
|
+
}).exec();
|
|
109
|
+
}, 500);
|
|
116
110
|
});
|
|
117
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
confirm,
|
|
113
|
+
clear,
|
|
114
|
+
classes,
|
|
115
|
+
startEventHandler,
|
|
116
|
+
moveEventHandler,
|
|
117
|
+
endEventHandler,
|
|
118
|
+
leaveEventHandler
|
|
119
|
+
};
|
|
118
120
|
}
|
|
119
121
|
});
|
|
120
|
-
const _hoisted_1 = {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
const _hoisted_2 = ["height", "width"];
|
|
125
|
-
const _hoisted_3 = {
|
|
126
|
-
key: 1,
|
|
127
|
-
class: "nut-signature-unsopport"
|
|
128
|
-
};
|
|
129
|
-
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
|
|
130
|
-
const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
|
|
122
|
+
const _hoisted_1 = { class: "nut-signature-inner" };
|
|
123
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
|
|
124
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
|
|
131
125
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
132
126
|
const _component_nut_button = resolveComponent("nut-button");
|
|
133
127
|
return openBlock(), createElementBlock("div", {
|
|
134
128
|
class: normalizeClass(_ctx.classes)
|
|
135
129
|
}, [
|
|
136
130
|
createElementVNode("div", _hoisted_1, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
createElementVNode("canvas", {
|
|
132
|
+
class: "spcanvas",
|
|
133
|
+
id: "spcanvas",
|
|
134
|
+
canvasId: "spcanvas",
|
|
135
|
+
"canvas-id": "spcanvas",
|
|
136
|
+
type: "2d",
|
|
137
|
+
"disable-scroll": "true",
|
|
138
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.startEventHandler && _ctx.startEventHandler(...args)),
|
|
139
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.moveEventHandler && _ctx.moveEventHandler(...args)),
|
|
140
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.endEventHandler && _ctx.endEventHandler(...args)),
|
|
141
|
+
onTouchleave: _cache[3] || (_cache[3] = (...args) => _ctx.leaveEventHandler && _ctx.leaveEventHandler(...args))
|
|
142
|
+
}, null, 32)
|
|
143
|
+
]),
|
|
144
144
|
createVNode(_component_nut_button, {
|
|
145
145
|
class: "nut-signature-btn",
|
|
146
146
|
type: "default",
|
|
147
|
-
onClick: _cache[
|
|
147
|
+
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.clear())
|
|
148
148
|
}, {
|
|
149
149
|
default: withCtx(() => [
|
|
150
|
-
|
|
150
|
+
_hoisted_2
|
|
151
151
|
]),
|
|
152
152
|
_: 1
|
|
153
153
|
}),
|
|
154
154
|
createVNode(_component_nut_button, {
|
|
155
155
|
class: "nut-signature-btn",
|
|
156
156
|
type: "primary",
|
|
157
|
-
onClick: _cache[
|
|
157
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.confirm())
|
|
158
158
|
}, {
|
|
159
159
|
default: withCtx(() => [
|
|
160
|
-
|
|
160
|
+
_hoisted_3
|
|
161
161
|
]),
|
|
162
162
|
_: 1
|
|
163
163
|
})
|
|
164
164
|
], 2);
|
|
165
165
|
}
|
|
166
|
-
var
|
|
167
|
-
export {
|
|
166
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
167
|
+
export { index_taro as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { c as createComponent } from "./component.js";
|
|
7
|
-
import { toRefs, computed, onMounted, resolveComponent, openBlock, createElementBlock, renderSlot,
|
|
7
|
+
import { toRefs, computed, onMounted, resolveComponent, openBlock, createElementBlock, renderSlot, createElementVNode, createBlock, normalizeClass, normalizeStyle, createCommentVNode, Fragment, renderList } from "vue";
|
|
8
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
const component = {
|
|
10
10
|
props: {
|
|
@@ -94,10 +94,7 @@ const _hoisted_2 = {
|
|
|
94
94
|
key: 1,
|
|
95
95
|
class: "skeleton"
|
|
96
96
|
};
|
|
97
|
-
const _hoisted_3 = {
|
|
98
|
-
key: 0,
|
|
99
|
-
class: "skeleton-animation"
|
|
100
|
-
};
|
|
97
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("view", { class: "skeleton-animation" }, null, -1);
|
|
101
98
|
const _hoisted_4 = { class: "content" };
|
|
102
99
|
const _hoisted_5 = { class: "content-line" };
|
|
103
100
|
const _hoisted_6 = {
|
|
@@ -109,7 +106,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
109
106
|
return !_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
110
107
|
renderSlot(_ctx.$slots, "default")
|
|
111
108
|
])) : (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
112
|
-
|
|
109
|
+
_hoisted_3,
|
|
113
110
|
createElementVNode("view", _hoisted_4, [
|
|
114
111
|
_ctx.avatar ? (openBlock(), createBlock(_component_nut_avatar, {
|
|
115
112
|
key: 0,
|
|
@@ -125,9 +122,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
125
122
|
}, null, 6)) : createCommentVNode("", true),
|
|
126
123
|
createElementVNode("view", _hoisted_5, [
|
|
127
124
|
_ctx.title ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true),
|
|
128
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.row), (item,
|
|
125
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.row), (item, index) => {
|
|
129
126
|
return openBlock(), createElementBlock("view", {
|
|
130
|
-
key:
|
|
127
|
+
key: index,
|
|
131
128
|
class: normalizeClass(_ctx.blockClass),
|
|
132
129
|
style: normalizeStyle({ width: _ctx.width, height: _ctx.height })
|
|
133
130
|
}, null, 6);
|
|
@@ -136,5 +133,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
136
133
|
])
|
|
137
134
|
]));
|
|
138
135
|
}
|
|
139
|
-
var
|
|
140
|
-
export {
|
|
136
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
137
|
+
export { index_taro as default };
|