uview-plus 3.8.55 → 3.8.106
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 +2147 -1828
- package/components/u-action-sheet/props.js +3 -1
- package/components/u-action-sheet/u-action-sheet.vue +22 -2
- package/components/u-album/props.js +3 -1
- package/components/u-alert/props.js +4 -2
- package/components/u-avatar/props.js +4 -1
- package/components/u-avatar-group/props.js +4 -1
- package/components/u-back-top/props.js +4 -1
- package/components/u-badge/props.js +4 -1
- package/components/u-barcode/u-barcode.vue +44 -15
- package/components/u-box/props.js +5 -2
- package/components/u-button/props.js +4 -1
- package/components/u-button/u-button.vue +2 -5
- package/components/u-button/vue.scss +3 -3
- package/components/u-calendar/calendar.js +8 -0
- package/components/u-calendar/props.js +43 -1
- package/components/u-calendar/u-calendar.vue +16 -0
- package/components/u-calendar-strip/props.js +3 -1
- package/components/u-canvas/u-canvas.vue +1028 -423
- package/components/u-car-keyboard/props.js +3 -1
- package/components/u-card/props.js +3 -1
- package/components/u-cell/props.js +4 -1
- package/components/u-cell/u-cell.vue +9 -1
- package/components/u-cell-group/props.js +4 -1
- package/components/u-checkbox/props.js +4 -1
- package/components/u-checkbox/u-checkbox.vue +7 -3
- package/components/u-checkbox-group/props.js +3 -1
- package/components/u-circle-progress/props.js +4 -1
- package/components/u-code/props.js +4 -1
- package/components/u-code-input/props.js +4 -1
- package/components/u-col/props.js +4 -1
- package/components/u-collapse/props.js +4 -1
- package/components/u-collapse-item/props.js +4 -1
- package/components/u-color-picker/u-color-picker.vue +1 -0
- package/components/u-column-notice/props.js +4 -1
- package/components/u-count-down/props.js +4 -1
- package/components/u-count-to/props.js +4 -1
- package/components/u-cropper/u-cropper.vue +95 -51
- package/components/u-datetime-picker/props.js +4 -1
- package/components/u-datetime-picker/u-datetime-picker.vue +53 -4
- package/components/u-divider/props.js +4 -1
- package/components/u-dragsort/u-dragsort.vue +57 -32
- package/components/u-dropdown/props.js +3 -1
- package/components/u-dropdown-item/props.js +3 -1
- package/components/u-empty/props.js +4 -1
- package/components/u-form/props.js +4 -1
- package/components/u-form-item/props.js +4 -1
- package/components/u-gap/props.js +4 -1
- package/components/u-grid/props.js +4 -1
- package/components/u-grid-item/props.js +4 -1
- package/components/u-guide/props.js +3 -1
- package/components/u-icon/props.js +4 -1
- package/components/u-icon/u-icon.vue +11 -2
- package/components/u-icon/upicon.ttf +0 -0
- package/components/u-icon/util.js +103 -10
- package/components/u-image/props.js +4 -1
- package/components/u-image/u-image.vue +280 -267
- package/components/u-index-anchor/props.js +4 -1
- package/components/u-index-item/props.js +2 -1
- package/components/u-index-item/u-index-item.vue +1 -1
- package/components/u-index-list/props.js +4 -1
- package/components/u-index-list/u-index-list.vue +1 -1
- package/components/u-input/props.js +3 -1
- package/components/u-keyboard/props.js +4 -1
- package/components/u-line/props.js +4 -1
- package/components/u-line-progress/props.js +6 -3
- package/components/u-link/props.js +4 -1
- package/components/u-list/props.js +4 -1
- package/components/u-list-item/props.js +4 -1
- package/components/u-loading-icon/props.js +4 -1
- package/components/u-loading-page/props.js +3 -1
- package/components/u-loadmore/props.js +4 -1
- package/components/u-markdown/u-markdown.vue +45 -3
- package/components/u-modal/props.js +4 -1
- package/components/u-navbar/props.js +4 -2
- package/components/u-navbar/u-navbar.vue +15 -9
- package/components/u-no-network/props.js +4 -1
- package/components/u-notice-bar/props.js +4 -1
- package/components/u-notify/props.js +4 -1
- package/components/u-novel-reader/content-normalizer.js +80 -0
- package/components/u-novel-reader/layout-engine.js +225 -0
- package/components/u-novel-reader/measure-adapter.js +69 -0
- package/components/u-novel-reader/novelReader.js +35 -0
- package/components/u-novel-reader/persistence.js +144 -0
- package/components/u-novel-reader/props.js +100 -0
- package/components/u-novel-reader/reader-catalog.vue +234 -0
- package/components/u-novel-reader/reader-content.vue +226 -0
- package/components/u-novel-reader/reader-core.js +151 -0
- package/components/u-novel-reader/reader-settings.vue +325 -0
- package/components/u-novel-reader/reader-toolbar.vue +313 -0
- package/components/u-novel-reader/theme-vars.scss +49 -0
- package/components/u-novel-reader/u-novel-reader.vue +836 -0
- package/components/u-number-box/props.js +4 -1
- package/components/u-number-box/u-number-box.vue +2 -2
- package/components/u-number-keyboard/props.js +4 -1
- package/components/u-overlay/props.js +4 -1
- package/components/u-pagination/u-pagination.vue +60 -39
- package/components/u-parse/props.js +4 -1
- package/components/u-picker/props.js +4 -1
- package/components/u-picker-column/props.js +3 -1
- package/components/u-popover/props.js +2 -1
- package/components/u-popup/props.js +4 -1
- package/components/u-poster/u-poster.vue +246 -214
- package/components/u-qrcode/qrcode.js +105 -97
- package/components/u-qrcode/u-qrcode.vue +242 -289
- package/components/u-radio/props.js +4 -1
- package/components/u-radio/u-radio.vue +7 -3
- package/components/u-radio-group/props.js +4 -1
- package/components/u-rate/props.js +4 -1
- package/components/u-read-more/props.js +4 -1
- package/components/u-row/props.js +4 -1
- package/components/u-row-notice/props.js +4 -1
- package/components/u-safe-bottom/props.js +2 -1
- package/components/u-scroll-list/props.js +4 -1
- package/components/u-scroll-list/scrollWxs.wxs +1 -1
- package/components/u-search/props.js +3 -1
- package/components/u-skeleton/props.js +4 -1
- package/components/u-slider/props.js +3 -1
- package/components/u-slider/u-slider.vue +71 -29
- package/components/u-status-bar/props.js +4 -1
- package/components/u-steps/props.js +4 -1
- package/components/u-steps-item/props.js +4 -1
- package/components/u-sticky/props.js +4 -1
- package/components/u-sticky/u-sticky.vue +11 -0
- package/components/u-subsection/props.js +3 -1
- package/components/u-swipe-action/props.js +4 -1
- package/components/u-swipe-action-item/index.wxs +43 -25
- package/components/u-swipe-action-item/nvue.js +9 -0
- package/components/u-swipe-action-item/other.js +32 -21
- package/components/u-swipe-action-item/props.js +9 -1
- package/components/u-swipe-action-item/swipeActionItem.js +1 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +42 -4
- package/components/u-swiper/props.js +9 -1
- package/components/u-swiper/swiper.js +1 -0
- package/components/u-swiper/u-swiper.vue +2 -0
- package/components/u-swiper-indicator/props.js +4 -1
- package/components/u-switch/props.js +4 -1
- package/components/u-switch/u-switch.vue +1 -1
- package/components/u-tabbar/props.js +3 -1
- package/components/u-tabbar/u-tabbar.vue +2 -1
- package/components/u-tabbar-item/props.js +4 -1
- package/components/u-tabbar-item/u-tabbar-item.vue +64 -21
- package/components/u-table/props.js +3 -1
- package/components/u-table2/tableRow.vue +155 -69
- package/components/u-table2/u-table2.vue +327 -137
- package/components/u-tabs/props.js +4 -1
- package/components/u-tabs/u-tabs.vue +11 -8
- package/components/u-tabs-item/props.js +3 -1
- package/components/u-tabs-pro/u-tabs-pro.vue +212 -0
- package/components/u-tag/props.js +4 -1
- package/components/u-td/props.js +3 -1
- package/components/u-text/props.js +4 -1
- package/components/u-text/text.js +1 -1
- package/components/u-text/u-text.vue +18 -6
- package/components/u-textarea/props.js +3 -1
- package/components/u-textarea/u-textarea.vue +16 -5
- package/components/u-th/props.js +3 -1
- package/components/u-toolbar/props.js +4 -1
- package/components/u-tooltip/props.js +10 -2
- package/components/u-tooltip/tooltip.js +2 -1
- package/components/u-tooltip/u-tooltip.vue +31 -3
- package/components/u-tr/props.js +3 -1
- package/components/u-transition/nvue-ani-map.js +75 -68
- package/components/u-transition/props.js +4 -1
- package/components/u-transition/transitionMixin.js +164 -163
- package/components/u-upload/props.js +4 -1
- package/components/u-upload/u-upload.vue +48 -41
- package/components/u-waterfall/u-waterfall.vue +162 -110
- package/index.js +65 -8
- package/libs/config/config.js +1 -1
- package/libs/config/props.js +180 -204
- package/libs/css/components.scss +3 -0
- package/libs/function/index.js +66 -0
- package/libs/function/uni-api-shims.js +29 -0
- package/libs/i18n/index.js +71 -36
- package/libs/i18n/locale-packs.js +11 -0
- package/libs/i18n/locales/all.js +23 -0
- package/libs/i18n/locales/{de.json → de.js} +1 -1
- package/libs/i18n/locales/{en.json → en.js} +2 -2
- package/libs/i18n/locales/{es.json → es.js} +1 -1
- package/libs/i18n/locales/{fr.json → fr.js} +2 -2
- package/libs/i18n/locales/{ja.json → ja.js} +1 -1
- package/libs/i18n/locales/{ko.json → ko.js} +1 -1
- package/libs/i18n/locales/{ru.json → ru.js} +1 -1
- package/libs/i18n/locales/{th.json → th.js} +1 -1
- package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
- package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
- package/libs/mixin/mixin.js +18 -54
- package/libs/root/index.js +78 -5
- package/libs/root/page.js +7 -7
- package/libs/root/root.js +73 -3
- package/libs/util/app-nvue-webview-canvas.js +486 -0
- package/libs/util/gcanvas/bridge/bridge-weex.js +10 -7
- package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
- package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
- package/libs/util/gcanvas/context-webgl/Program.js +0 -0
- package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
- package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
- package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
- package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
- package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
- package/libs/util/gcanvas/env/canvas.js +0 -0
- package/libs/util/gcanvas/env/image.js +0 -0
- package/libs/util/gcanvas/env/tool.js +0 -0
- package/libs/util/gcanvas/index.js +3 -3
- package/package.json +4 -5
- package/tsconfig.json +18 -0
- package/types/comps/calendar.d.ts +38 -0
- package/types/comps/checkbox.d.ts +12 -0
- package/types/comps/lineProgress.d.ts +5 -0
- package/types/comps/navbar.d.ts +3 -3
- package/types/comps/swipeActionItem.d.ts +13 -0
- package/types/comps/swiper.d.ts +5 -0
- package/types/comps/tabs.d.ts +2 -1
- package/types/comps/text.d.ts +1 -1
- package/types/comps/tooltip.d.ts +36 -1
- package/types/func.d.ts +23 -0
- package/types/index.d.ts +1 -0
- /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
|
@@ -4,36 +4,36 @@
|
|
|
4
4
|
:style="{
|
|
5
5
|
width: useRootHeightAndWidth ? '100%' : 'auto',
|
|
6
6
|
height: useRootHeightAndWidth ? '100%' : 'auto',
|
|
7
|
-
|
|
8
|
-
@longpress="longpress">
|
|
9
|
-
<view
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<!-- #endif -->
|
|
35
|
-
<view v-if="showLoading && loading" class="u-qrcode__loading"
|
|
36
|
-
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }">
|
|
7
|
+
}"
|
|
8
|
+
@longpress="longpress">
|
|
9
|
+
<view
|
|
10
|
+
class="u-qrcode__content"
|
|
11
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }"
|
|
12
|
+
@click="preview">
|
|
13
|
+
<!-- #ifdef APP-NVUE -->
|
|
14
|
+
<up-canvas
|
|
15
|
+
ref="qrcodeCanvas"
|
|
16
|
+
class="u-qrcode__canvas"
|
|
17
|
+
:canvas-id="cid"
|
|
18
|
+
:width="sizeLocal"
|
|
19
|
+
:height="sizeLocal"
|
|
20
|
+
:unit="unit"
|
|
21
|
+
bg-color="transparent"
|
|
22
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
23
|
+
<!-- #endif -->
|
|
24
|
+
<!-- #ifndef APP-NVUE -->
|
|
25
|
+
<up-canvas
|
|
26
|
+
ref="qrcodeCanvas"
|
|
27
|
+
class="u-qrcode__canvas"
|
|
28
|
+
:canvas-id="cid"
|
|
29
|
+
:width="sizeLocal"
|
|
30
|
+
:height="sizeLocal"
|
|
31
|
+
:unit="unit"
|
|
32
|
+
bg-color="transparent"
|
|
33
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
34
|
+
<!-- #endif -->
|
|
35
|
+
<view v-if="showLoading && loading" class="u-qrcode__loading"
|
|
36
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }">
|
|
37
37
|
<up-loading-icon vertical :text="loadingText" textSize="14px"></up-loading-icon>
|
|
38
38
|
</view>
|
|
39
39
|
</view>
|
|
@@ -41,22 +41,9 @@
|
|
|
41
41
|
</view>
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
|
-
<script>
|
|
45
|
-
import QRCode from "./qrcode.js"
|
|
46
|
-
|
|
47
|
-
// #ifdef APP-NVUE
|
|
48
|
-
// https://github.com/dcloudio/NvueCanvasDemo/blob/master/README.md
|
|
49
|
-
import {
|
|
50
|
-
enable,
|
|
51
|
-
WeexBridge,
|
|
52
|
-
Image as GImage
|
|
53
|
-
} from '../../libs/util/gcanvas/index.js';
|
|
54
|
-
import { nextTick } from "vue";
|
|
55
|
-
// #endif
|
|
56
|
-
let qrcode
|
|
57
|
-
// 20260201不能在data中存储canvas,否则会导致在微信小程序getContext获取不到canvas对象报错Cannot read property 'type'
|
|
58
|
-
let canvas = null
|
|
59
|
-
export default {
|
|
44
|
+
<script>
|
|
45
|
+
import QRCode from "./qrcode.js"
|
|
46
|
+
export default {
|
|
60
47
|
name: "u-qrcode",
|
|
61
48
|
props: {
|
|
62
49
|
cid: {
|
|
@@ -149,103 +136,98 @@ export default {
|
|
|
149
136
|
{
|
|
150
137
|
name: '保存二维码',
|
|
151
138
|
}
|
|
152
|
-
],
|
|
153
|
-
rootId: `rootId${Number(Math.random() * 100).toFixed(0)}`,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.isNvue = true
|
|
176
|
-
// #endif
|
|
177
|
-
this.ctx = this.getUPCanvasContext('2d')
|
|
178
|
-
|
|
179
|
-
if (this.loadMake) {
|
|
139
|
+
],
|
|
140
|
+
rootId: `rootId${Number(Math.random() * 100).toFixed(0)}`,
|
|
141
|
+
canvasObj: {},
|
|
142
|
+
sizeLocal: this.size,
|
|
143
|
+
ctx: null,
|
|
144
|
+
isNvue: false,
|
|
145
|
+
canvasHost: null
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
created() {
|
|
149
|
+
this._qrcode = null
|
|
150
|
+
},
|
|
151
|
+
async mounted(){
|
|
152
|
+
// 如果使用根节点的宽高 则 重新设置 size
|
|
153
|
+
if(this.useRootHeightAndWidth){
|
|
154
|
+
await this.setNewSize()
|
|
155
|
+
}
|
|
156
|
+
// #ifdef APP-NVUE
|
|
157
|
+
this.isNvue = true
|
|
158
|
+
// #endif
|
|
159
|
+
await this.initCanvas()
|
|
160
|
+
|
|
161
|
+
if (this.loadMake) {
|
|
180
162
|
if (!this._empty(this.val)) {
|
|
181
163
|
setTimeout(() => {
|
|
182
164
|
setTimeout(()=>{
|
|
183
|
-
this._makeCode()
|
|
165
|
+
this._makeCode().catch(error => {
|
|
166
|
+
console.error('二维码生成失败', error)
|
|
167
|
+
})
|
|
184
168
|
})
|
|
185
169
|
}, 0);
|
|
186
170
|
}
|
|
187
171
|
}
|
|
188
|
-
},
|
|
189
|
-
methods: {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
_clearCode() {
|
|
246
|
-
this._result('')
|
|
247
|
-
qrcode.clear()
|
|
172
|
+
},
|
|
173
|
+
methods: {
|
|
174
|
+
async _makeCode() {
|
|
175
|
+
let that = this
|
|
176
|
+
if (this._empty(this.val)) {
|
|
177
|
+
uni.showToast({
|
|
178
|
+
title: '二维码内容不能为空',
|
|
179
|
+
icon: 'none',
|
|
180
|
+
duration: 2000
|
|
181
|
+
});
|
|
182
|
+
return ''
|
|
183
|
+
}
|
|
184
|
+
if (!this.ctx) {
|
|
185
|
+
await this.initCanvas(true)
|
|
186
|
+
}
|
|
187
|
+
if (!this.ctx) throw new Error('无法获取二维码画布实例')
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
this.loading = true
|
|
190
|
+
try {
|
|
191
|
+
this._qrcode = new QRCode({
|
|
192
|
+
vuectx: that, // 上下文环境
|
|
193
|
+
canvasId: that.cid, // canvas-id
|
|
194
|
+
ctx: that.ctx,
|
|
195
|
+
canvasHost: that.canvasHost,
|
|
196
|
+
isNvue: that.isNvue,
|
|
197
|
+
usingComponents: that.usingComponents, // 是否是自定义组件
|
|
198
|
+
showLoading: false, // 是否显示loading
|
|
199
|
+
loadingText: that.loadingText, // loading文字
|
|
200
|
+
text: that.val, // 生成内容
|
|
201
|
+
size: that.sizeLocal, // 二维码大小
|
|
202
|
+
width: that.sizeLocal,
|
|
203
|
+
height: that.sizeLocal,
|
|
204
|
+
background: that.background, // 背景色
|
|
205
|
+
foreground: that.foreground, // 前景色
|
|
206
|
+
pdground: that.pdground, // 定位角点颜色
|
|
207
|
+
quietZone: that.quietZone, // 静区宽度
|
|
208
|
+
correctLevel: that.lv, // 容错级别
|
|
209
|
+
image: that.icon, // 二维码图标
|
|
210
|
+
imageSize: that.iconSize,// 二维码图标大小
|
|
211
|
+
cbResult: function (res) { // 生成二维码的回调
|
|
212
|
+
if (typeof res === 'string') {
|
|
213
|
+
that._result(res)
|
|
214
|
+
resolve(res)
|
|
215
|
+
} else {
|
|
216
|
+
that.loading = false
|
|
217
|
+
reject(res instanceof Error ? res : new Error(`二维码生成失败: ${JSON.stringify(res)}`))
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
} catch (error) {
|
|
222
|
+
that.loading = false
|
|
223
|
+
reject(error)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
248
226
|
},
|
|
227
|
+
_clearCode() {
|
|
228
|
+
this._result('')
|
|
229
|
+
if (this._qrcode) this._qrcode.clear()
|
|
230
|
+
},
|
|
249
231
|
_saveCode() {
|
|
250
232
|
let that = this;
|
|
251
233
|
if (this.result != "") {
|
|
@@ -305,42 +287,28 @@ export default {
|
|
|
305
287
|
url: this.result
|
|
306
288
|
}, e)
|
|
307
289
|
},
|
|
308
|
-
async toTempFilePath({success, fail}) {
|
|
309
|
-
|
|
310
|
-
this.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
// #ifndef H5
|
|
332
|
-
uni.canvasToTempFilePath(
|
|
333
|
-
{
|
|
334
|
-
canvasId: this.cid,
|
|
335
|
-
success :res => {
|
|
336
|
-
success(res)
|
|
337
|
-
},
|
|
338
|
-
fail: fail
|
|
339
|
-
},
|
|
340
|
-
this)
|
|
341
|
-
// #endif
|
|
342
|
-
}
|
|
343
|
-
},
|
|
290
|
+
async toTempFilePath({success, fail} = {}) {
|
|
291
|
+
try {
|
|
292
|
+
if (!this.canvasHost) {
|
|
293
|
+
await this.initCanvas(true)
|
|
294
|
+
}
|
|
295
|
+
if (!this.canvasHost) {
|
|
296
|
+
throw new Error('无法获取二维码画布实例')
|
|
297
|
+
}
|
|
298
|
+
const res = await this.canvasHost.toTempFilePath({
|
|
299
|
+
width: this.sizeLocal,
|
|
300
|
+
height: this.sizeLocal
|
|
301
|
+
})
|
|
302
|
+
if (success) success(res)
|
|
303
|
+
return res
|
|
304
|
+
} catch (error) {
|
|
305
|
+
if (fail) {
|
|
306
|
+
fail(error)
|
|
307
|
+
return false
|
|
308
|
+
}
|
|
309
|
+
throw error
|
|
310
|
+
}
|
|
311
|
+
},
|
|
344
312
|
async longpress() {
|
|
345
313
|
this.toTempFilePath({
|
|
346
314
|
success: res => {
|
|
@@ -355,9 +323,10 @@ export default {
|
|
|
355
323
|
* 使用根节点宽高 设置新的size
|
|
356
324
|
* @return {Promise<void>}
|
|
357
325
|
*/
|
|
358
|
-
async setNewSize(){
|
|
359
|
-
const rootNode = await this.
|
|
360
|
-
|
|
326
|
+
async setNewSize(){
|
|
327
|
+
const rootNode = await this.getRootNode();
|
|
328
|
+
if (!rootNode) return
|
|
329
|
+
const { width , height } = rootNode;
|
|
361
330
|
// 将最短的设置为二维码 的size
|
|
362
331
|
if(width > height){
|
|
363
332
|
this.sizeLocal = height
|
|
@@ -367,99 +336,68 @@ export default {
|
|
|
367
336
|
}
|
|
368
337
|
},
|
|
369
338
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
img = new Image();
|
|
433
|
-
// #endif
|
|
434
|
-
|
|
435
|
-
// #ifdef MP
|
|
436
|
-
// 小程序2d
|
|
437
|
-
// https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html
|
|
438
|
-
img = canvas.createImage();
|
|
439
|
-
// #endif
|
|
440
|
-
// #ifdef APP-NVUE
|
|
441
|
-
let that = this
|
|
442
|
-
// console.log(img)
|
|
443
|
-
img.onload = function(){
|
|
444
|
-
if (process.env.NODE_ENV === 'development') {
|
|
445
|
-
console.log('drawImage绘制2...')
|
|
446
|
-
}
|
|
447
|
-
that.cxt.drawImage(img, x, y, w, h);
|
|
448
|
-
}
|
|
449
|
-
// #endif
|
|
450
|
-
// #ifdef H5 || MP
|
|
451
|
-
img.onload = () => {
|
|
452
|
-
this.ctx.drawImage(img, x, y, w, h);
|
|
453
|
-
};
|
|
454
|
-
// #endif
|
|
455
|
-
img.src = url;
|
|
456
|
-
// #ifdef APP-VUE
|
|
457
|
-
this.ctx.drawImage(url, x, y, w, h);
|
|
458
|
-
// #endif
|
|
459
|
-
} catch (error) {
|
|
460
|
-
console.log('drawImage绘制出错', error)
|
|
461
|
-
}
|
|
462
|
-
},
|
|
339
|
+
async getRootNode() {
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
try {
|
|
342
|
+
const query = uni.createSelectorQuery().in(this).select(`#${this.rootId}`);
|
|
343
|
+
query.fields({
|
|
344
|
+
size: true
|
|
345
|
+
})
|
|
346
|
+
.exec((res) => {
|
|
347
|
+
resolve(res[0] || false)
|
|
348
|
+
})
|
|
349
|
+
} catch (e) {
|
|
350
|
+
console.error("获取二维码根节点失败", e)
|
|
351
|
+
resolve(false)
|
|
352
|
+
}
|
|
353
|
+
})
|
|
354
|
+
},
|
|
355
|
+
async initCanvas(force = false) {
|
|
356
|
+
await this.$nextTick()
|
|
357
|
+
const canvasRef = this.$refs.qrcodeCanvas
|
|
358
|
+
if (!canvasRef) return false
|
|
359
|
+
const initialized = await canvasRef.initCanvas(force)
|
|
360
|
+
if (!initialized) {
|
|
361
|
+
this.canvasHost = null
|
|
362
|
+
this.ctx = null
|
|
363
|
+
return false
|
|
364
|
+
}
|
|
365
|
+
this.canvasHost = canvasRef
|
|
366
|
+
this.ctx = canvasRef.getRawContext()
|
|
367
|
+
return !!this.ctx
|
|
368
|
+
},
|
|
369
|
+
async refreshCanvas(force = false) {
|
|
370
|
+
await this.$nextTick()
|
|
371
|
+
return this.initCanvas(force)
|
|
372
|
+
},
|
|
373
|
+
getUPCanvasContext() {
|
|
374
|
+
return this.canvasHost ? this.canvasHost.getRawContext() : null
|
|
375
|
+
},
|
|
376
|
+
async drawImage(url, x, y, w, h) {
|
|
377
|
+
try {
|
|
378
|
+
if (!this.canvasHost) {
|
|
379
|
+
const initialized = await this.initCanvas(true)
|
|
380
|
+
if (!initialized) {
|
|
381
|
+
throw new Error('无法初始化二维码画布')
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (!this.canvasHost || !this.ctx) {
|
|
385
|
+
throw new Error('无法获取二维码画布实例')
|
|
386
|
+
}
|
|
387
|
+
await this.canvasHost.drawImage(url, x, y, w, h)
|
|
388
|
+
} catch (error) {
|
|
389
|
+
console.error('drawImage绘制出错', error)
|
|
390
|
+
throw error
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
_queueMakeCode(delay = 0) {
|
|
394
|
+
if (this._empty(this.val)) return
|
|
395
|
+
setTimeout(() => {
|
|
396
|
+
this._makeCode().catch(error => {
|
|
397
|
+
console.error('二维码生成失败', error)
|
|
398
|
+
})
|
|
399
|
+
}, delay)
|
|
400
|
+
},
|
|
463
401
|
|
|
464
402
|
selectClick(index) {
|
|
465
403
|
switch (index) {
|
|
@@ -492,33 +430,48 @@ export default {
|
|
|
492
430
|
},
|
|
493
431
|
},
|
|
494
432
|
watch: {
|
|
495
|
-
size: function (n, o) {
|
|
496
|
-
if (n != o && !this._empty(n)) {
|
|
497
|
-
this.
|
|
498
|
-
if (
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
433
|
+
size: function (n, o) {
|
|
434
|
+
if (n != o && !this._empty(n)) {
|
|
435
|
+
this.sizeLocal = n
|
|
436
|
+
if (this.onval) {
|
|
437
|
+
this._queueMakeCode(100)
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
val: function (n, o) {
|
|
442
|
+
if (this.onval) {
|
|
443
|
+
if (n != o && !this._empty(n)) {
|
|
444
|
+
this._queueMakeCode()
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
icon: function (n, o) {
|
|
449
|
+
if (n === o) return
|
|
450
|
+
this._queueMakeCode(100)
|
|
451
|
+
},
|
|
452
|
+
background: function () {
|
|
453
|
+
this._queueMakeCode()
|
|
454
|
+
},
|
|
455
|
+
foreground: function () {
|
|
456
|
+
this._queueMakeCode()
|
|
457
|
+
},
|
|
458
|
+
iconSize: function () {
|
|
459
|
+
this._queueMakeCode()
|
|
460
|
+
},
|
|
461
|
+
quietZone: function () {
|
|
462
|
+
this._queueMakeCode()
|
|
463
|
+
},
|
|
464
|
+
lv: function () {
|
|
465
|
+
this._queueMakeCode()
|
|
466
|
+
}
|
|
514
467
|
},
|
|
515
468
|
computed: {
|
|
516
469
|
}
|
|
517
470
|
}
|
|
518
471
|
</script>
|
|
519
|
-
<style lang="scss" scoped>
|
|
520
|
-
.u-qrcode {
|
|
521
|
-
&__loading {
|
|
472
|
+
<style lang="scss" scoped>
|
|
473
|
+
.u-qrcode {
|
|
474
|
+
&__loading {
|
|
522
475
|
display: flex;
|
|
523
476
|
justify-content: center;
|
|
524
477
|
align-items: center;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import RadioDefaultProps from './radio'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(RadioDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// radio的名称
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:class="iconClasses"
|
|
12
12
|
:style="[iconWrapStyle]"
|
|
13
13
|
>
|
|
14
|
-
<slot name="icon" :elIconSize="elIconSize" :elIconColor="elIconColor">
|
|
14
|
+
<slot name="icon" :elIconSize="elIconSize" :elIconColor="elIconColor" :checked="checked" :elDisabled="elDisabled">
|
|
15
15
|
<up-icon
|
|
16
16
|
class="u-radio__icon-wrap__icon"
|
|
17
17
|
name="checkbox-mark"
|
|
@@ -145,8 +145,12 @@
|
|
|
145
145
|
if (this.elDisabled) {
|
|
146
146
|
classes.push('u-radio__icon-wrap--disabled')
|
|
147
147
|
}
|
|
148
|
-
if (this.checked
|
|
149
|
-
|
|
148
|
+
if (this.checked) {
|
|
149
|
+
if (this.elDisabled) {
|
|
150
|
+
classes.push('u-radio__icon-wrap--disabled--checked')
|
|
151
|
+
} else {
|
|
152
|
+
classes.push('u-radio__icon-wrap--checked')
|
|
153
|
+
}
|
|
150
154
|
}
|
|
151
155
|
// 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
|
|
152
156
|
// #ifdef MP-ALIPAY || MP-TOUTIAO
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import RadioGroupDefaultProps from './radioGroup'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(RadioGroupDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// #ifdef VUE3
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import RateDefaultProps from './rate'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(RateDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// #ifdef VUE3
|