@gmcb/uv-ui 0.2.26
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 +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :id="attrs.id" :class="'_block _'+name+' '+attrs.class" :style="attrs.style">
|
|
3
|
+
<block v-for="(n, i) in childs" v-bind:key="i">
|
|
4
|
+
<!-- 图片 -->
|
|
5
|
+
<!-- 占位图 -->
|
|
6
|
+
<image v-if="n.name==='img'&&!n.t&&((opts[1]&&!ctrl[i])||ctrl[i]<0)" class="_img" :style="n.attrs.style" :src="ctrl[i]<0?opts[2]:opts[1]" mode="widthFix" />
|
|
7
|
+
<!-- 显示图片 -->
|
|
8
|
+
<!-- #ifdef H5 || (APP-PLUS && VUE2) -->
|
|
9
|
+
<img v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
10
|
+
<!-- #endif -->
|
|
11
|
+
<!-- #ifndef H5 || (APP-PLUS && VUE2) -->
|
|
12
|
+
<!-- 表格中的图片,使用 rich-text 防止大小不正确 -->
|
|
13
|
+
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style,src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" />
|
|
14
|
+
<!-- #endif -->
|
|
15
|
+
<!-- #ifndef H5 || APP-PLUS -->
|
|
16
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
17
|
+
<!-- #endif -->
|
|
18
|
+
<!-- #ifdef APP-PLUS && VUE3 -->
|
|
19
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
20
|
+
<!-- #endif -->
|
|
21
|
+
<!-- 文本 -->
|
|
22
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
23
|
+
<text v-else-if="n.text" :user-select="opts[4]=='force'&&isiOS" decode>{{n.text}}</text>
|
|
24
|
+
<!-- #endif -->
|
|
25
|
+
<!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -->
|
|
26
|
+
<text v-else-if="n.text" decode>{{n.text}}</text>
|
|
27
|
+
<!-- #endif -->
|
|
28
|
+
<text v-else-if="n.name==='br'">\n</text>
|
|
29
|
+
<!-- 链接 -->
|
|
30
|
+
<view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap">
|
|
31
|
+
<node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
|
|
32
|
+
</view>
|
|
33
|
+
<!-- 视频 -->
|
|
34
|
+
<!-- #ifdef APP-PLUS -->
|
|
35
|
+
<view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" @vplay.stop="play" />
|
|
36
|
+
<!-- #endif -->
|
|
37
|
+
<!-- #ifndef APP-PLUS -->
|
|
38
|
+
<video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
|
|
39
|
+
<!-- #endif -->
|
|
40
|
+
<!-- #ifdef H5 || APP-PLUS -->
|
|
41
|
+
<iframe v-else-if="n.name==='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" />
|
|
42
|
+
<embed v-else-if="n.name==='embed'" :style="n.attrs.style" :src="n.attrs.src" />
|
|
43
|
+
<!-- #endif -->
|
|
44
|
+
<!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) -->
|
|
45
|
+
<!-- 音频 -->
|
|
46
|
+
<audio v-else-if="n.name==='audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
|
|
47
|
+
<!-- #endif -->
|
|
48
|
+
<view v-else-if="(n.name==='table'&&n.c)||n.name==='li'" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.attrs.style">
|
|
49
|
+
<node v-if="n.name==='li'" :childs="n.children" :opts="opts" />
|
|
50
|
+
<view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style">
|
|
51
|
+
<node v-if="tbody.name==='td'||tbody.name==='th'" :childs="tbody.children" :opts="opts" />
|
|
52
|
+
<block v-else v-for="(tr, y) in tbody.children" v-bind:key="y">
|
|
53
|
+
<view v-if="tr.name==='td'||tr.name==='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
|
|
54
|
+
<node :childs="tr.children" :opts="opts" />
|
|
55
|
+
</view>
|
|
56
|
+
<view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
|
|
57
|
+
<view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style">
|
|
58
|
+
<node :childs="td.children" :opts="opts" />
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
</block>
|
|
62
|
+
</view>
|
|
63
|
+
</view>
|
|
64
|
+
|
|
65
|
+
<!-- 富文本 -->
|
|
66
|
+
<!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
|
|
67
|
+
<rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
|
|
68
|
+
<!-- #endif -->
|
|
69
|
+
<!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
|
|
70
|
+
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
|
|
71
|
+
<!-- #endif -->
|
|
72
|
+
<!-- 继续递归 -->
|
|
73
|
+
<view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
|
|
74
|
+
<node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs" :childs="n2.children" :opts="opts" />
|
|
75
|
+
</view>
|
|
76
|
+
<node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" />
|
|
77
|
+
</block>
|
|
78
|
+
</view>
|
|
79
|
+
</template>
|
|
80
|
+
<script module="handler" lang="wxs">
|
|
81
|
+
// 行内标签列表
|
|
82
|
+
var inlineTags = {
|
|
83
|
+
abbr: true,
|
|
84
|
+
b: true,
|
|
85
|
+
big: true,
|
|
86
|
+
code: true,
|
|
87
|
+
del: true,
|
|
88
|
+
em: true,
|
|
89
|
+
i: true,
|
|
90
|
+
ins: true,
|
|
91
|
+
label: true,
|
|
92
|
+
q: true,
|
|
93
|
+
small: true,
|
|
94
|
+
span: true,
|
|
95
|
+
strong: true,
|
|
96
|
+
sub: true,
|
|
97
|
+
sup: true
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @description 判断是否为行内标签
|
|
101
|
+
*/
|
|
102
|
+
module.exports = {
|
|
103
|
+
isInline: function (tagName, style) {
|
|
104
|
+
return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
<script>
|
|
109
|
+
|
|
110
|
+
import node from './node'
|
|
111
|
+
export default {
|
|
112
|
+
name: 'node',
|
|
113
|
+
options: {
|
|
114
|
+
// #ifdef MP-WEIXIN
|
|
115
|
+
virtualHost: true,
|
|
116
|
+
// #endif
|
|
117
|
+
// #ifdef MP-TOUTIAO
|
|
118
|
+
addGlobalClass: false
|
|
119
|
+
// #endif
|
|
120
|
+
},
|
|
121
|
+
data () {
|
|
122
|
+
return {
|
|
123
|
+
ctrl: {},
|
|
124
|
+
// #ifdef MP-WEIXIN
|
|
125
|
+
isiOS: uni.getSystemInfoSync().system.includes('iOS')
|
|
126
|
+
// #endif
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
props: {
|
|
130
|
+
name: String,
|
|
131
|
+
attrs: {
|
|
132
|
+
type: Object,
|
|
133
|
+
default () {
|
|
134
|
+
return {}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
childs: Array,
|
|
138
|
+
opts: Array
|
|
139
|
+
},
|
|
140
|
+
components: {
|
|
141
|
+
|
|
142
|
+
// #ifndef (H5 || APP-PLUS) && VUE3
|
|
143
|
+
node
|
|
144
|
+
// #endif
|
|
145
|
+
},
|
|
146
|
+
mounted () {
|
|
147
|
+
this.$nextTick(() => {
|
|
148
|
+
for (this.root = this.$parent; this.root.$options.name !== 'uv-parse'; this.root = this.root.$parent);
|
|
149
|
+
})
|
|
150
|
+
// #ifdef H5 || APP-PLUS
|
|
151
|
+
if (this.opts[0]) {
|
|
152
|
+
let i
|
|
153
|
+
for (i = this.childs.length; i--;) {
|
|
154
|
+
if (this.childs[i].name === 'img') break
|
|
155
|
+
}
|
|
156
|
+
if (i !== -1) {
|
|
157
|
+
this.observer = uni.createIntersectionObserver(this).relativeToViewport({
|
|
158
|
+
top: 500,
|
|
159
|
+
bottom: 500
|
|
160
|
+
})
|
|
161
|
+
this.observer.observe('._img', res => {
|
|
162
|
+
if (res.intersectionRatio) {
|
|
163
|
+
this.$set(this.ctrl, 'load', 1)
|
|
164
|
+
this.observer.disconnect()
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// #endif
|
|
170
|
+
},
|
|
171
|
+
beforeDestroy () {
|
|
172
|
+
// #ifdef H5 || APP-PLUS
|
|
173
|
+
if (this.observer) {
|
|
174
|
+
this.observer.disconnect()
|
|
175
|
+
}
|
|
176
|
+
// #endif
|
|
177
|
+
},
|
|
178
|
+
methods:{
|
|
179
|
+
// #ifdef MP-WEIXIN
|
|
180
|
+
toJSON () { return this },
|
|
181
|
+
// #endif
|
|
182
|
+
/**
|
|
183
|
+
* @description 播放视频事件
|
|
184
|
+
* @param {Event} e
|
|
185
|
+
*/
|
|
186
|
+
play (e) {
|
|
187
|
+
this.root.$emit('play')
|
|
188
|
+
// #ifndef APP-PLUS
|
|
189
|
+
if (this.root.pauseVideo) {
|
|
190
|
+
let flag = false
|
|
191
|
+
const id = e.target.id
|
|
192
|
+
for (let i = this.root._videos.length; i--;) {
|
|
193
|
+
if (this.root._videos[i].id === id) {
|
|
194
|
+
flag = true
|
|
195
|
+
} else {
|
|
196
|
+
this.root._videos[i].pause() // 自动暂停其他视频
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// 将自己加入列表
|
|
200
|
+
if (!flag) {
|
|
201
|
+
const ctx = uni.createVideoContext(id
|
|
202
|
+
// #ifndef MP-BAIDU
|
|
203
|
+
, this
|
|
204
|
+
// #endif
|
|
205
|
+
)
|
|
206
|
+
ctx.id = id
|
|
207
|
+
if (this.root.playbackRate) {
|
|
208
|
+
ctx.playbackRate(this.root.playbackRate)
|
|
209
|
+
}
|
|
210
|
+
this.root._videos.push(ctx)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// #endif
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @description 图片点击事件
|
|
218
|
+
* @param {Event} e
|
|
219
|
+
*/
|
|
220
|
+
imgTap (e) {
|
|
221
|
+
const node = this.childs[e.currentTarget.dataset.i]
|
|
222
|
+
if (node.a) {
|
|
223
|
+
this.linkTap(node.a)
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
if (node.attrs.ignore) return
|
|
227
|
+
// #ifdef H5 || APP-PLUS
|
|
228
|
+
node.attrs.src = node.attrs.src || node.attrs['data-src']
|
|
229
|
+
// #endif
|
|
230
|
+
this.root.$emit('imgtap', node.attrs)
|
|
231
|
+
// 自动预览图片
|
|
232
|
+
if (this.root.previewImg) {
|
|
233
|
+
uni.previewImage({
|
|
234
|
+
// #ifdef MP-WEIXIN
|
|
235
|
+
showmenu: this.root.showImgMenu,
|
|
236
|
+
// #endif
|
|
237
|
+
// #ifdef MP-ALIPAY
|
|
238
|
+
enablesavephoto: this.root.showImgMenu,
|
|
239
|
+
enableShowPhotoDownload: this.root.showImgMenu,
|
|
240
|
+
// #endif
|
|
241
|
+
current: parseInt(node.attrs.i),
|
|
242
|
+
urls: this.root.imgList
|
|
243
|
+
})
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @description 图片长按
|
|
249
|
+
*/
|
|
250
|
+
imgLongTap (e) {
|
|
251
|
+
// #ifdef APP-PLUS
|
|
252
|
+
const attrs = this.childs[e.currentTarget.dataset.i].attrs
|
|
253
|
+
if (this.opts[3] && !attrs.ignore) {
|
|
254
|
+
uni.showActionSheet({
|
|
255
|
+
itemList: ['保存图片'],
|
|
256
|
+
success: () => {
|
|
257
|
+
const save = path => {
|
|
258
|
+
uni.saveImageToPhotosAlbum({
|
|
259
|
+
filePath: path,
|
|
260
|
+
success () {
|
|
261
|
+
uni.showToast({
|
|
262
|
+
title: '保存成功'
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
if (this.root.imgList[attrs.i].startsWith('http')) {
|
|
268
|
+
uni.downloadFile({
|
|
269
|
+
url: this.root.imgList[attrs.i],
|
|
270
|
+
success: res => save(res.tempFilePath)
|
|
271
|
+
})
|
|
272
|
+
} else {
|
|
273
|
+
save(this.root.imgList[attrs.i])
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
// #endif
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @description 图片加载完成事件
|
|
283
|
+
* @param {Event} e
|
|
284
|
+
*/
|
|
285
|
+
imgLoad (e) {
|
|
286
|
+
const i = e.currentTarget.dataset.i
|
|
287
|
+
/* #ifndef H5 || (APP-PLUS && VUE2) */
|
|
288
|
+
if (!this.childs[i].w) {
|
|
289
|
+
// 设置原宽度
|
|
290
|
+
this.$set(this.ctrl, i, e.detail.width)
|
|
291
|
+
} else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) {
|
|
292
|
+
// 加载完毕,取消加载中占位图
|
|
293
|
+
this.$set(this.ctrl, i, 1)
|
|
294
|
+
}
|
|
295
|
+
this.checkReady()
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @description 检查是否所有图片加载完毕
|
|
300
|
+
*/
|
|
301
|
+
checkReady () {
|
|
302
|
+
if (this.root && !this.root.lazyLoad) {
|
|
303
|
+
this.root._unloadimgs -= 1
|
|
304
|
+
if (!this.root._unloadimgs) {
|
|
305
|
+
setTimeout(() => {
|
|
306
|
+
this.root.getRect().then(rect => {
|
|
307
|
+
this.root.$emit('ready', rect)
|
|
308
|
+
}).catch(() => {
|
|
309
|
+
this.root.$emit('ready', {})
|
|
310
|
+
})
|
|
311
|
+
}, 350)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @description 链接点击事件
|
|
318
|
+
* @param {Event} e
|
|
319
|
+
*/
|
|
320
|
+
linkTap (e) {
|
|
321
|
+
const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {}
|
|
322
|
+
const attrs = node.attrs || e
|
|
323
|
+
const href = attrs.href
|
|
324
|
+
this.root.$emit('linktap', Object.assign({
|
|
325
|
+
innerText: this.root.getText(node.children || []) // 链接内的文本内容
|
|
326
|
+
}, attrs))
|
|
327
|
+
if (href) {
|
|
328
|
+
if (href[0] === '#') {
|
|
329
|
+
// 跳转锚点
|
|
330
|
+
this.root.navigateTo(href.substring(1)).catch(() => { })
|
|
331
|
+
} else if (href.split('?')[0].includes('://')) {
|
|
332
|
+
// 复制外部链接
|
|
333
|
+
if (this.root.copyLink) {
|
|
334
|
+
// #ifdef H5
|
|
335
|
+
window.open(href)
|
|
336
|
+
// #endif
|
|
337
|
+
// #ifdef MP
|
|
338
|
+
uni.setClipboardData({
|
|
339
|
+
data: href,
|
|
340
|
+
success: () =>
|
|
341
|
+
uni.showToast({
|
|
342
|
+
title: '链接已复制'
|
|
343
|
+
})
|
|
344
|
+
})
|
|
345
|
+
// #endif
|
|
346
|
+
// #ifdef APP-PLUS
|
|
347
|
+
plus.runtime.openWeb(href)
|
|
348
|
+
// #endif
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
// 跳转页面
|
|
352
|
+
uni.navigateTo({
|
|
353
|
+
url: href,
|
|
354
|
+
fail () {
|
|
355
|
+
uni.switchTab({
|
|
356
|
+
url: href,
|
|
357
|
+
fail () { }
|
|
358
|
+
})
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @description 错误事件
|
|
367
|
+
* @param {Event} e
|
|
368
|
+
*/
|
|
369
|
+
mediaError (e) {
|
|
370
|
+
const i = e.currentTarget.dataset.i
|
|
371
|
+
const node = this.childs[i]
|
|
372
|
+
// 加载其他源
|
|
373
|
+
if (node.name === 'video' || node.name === 'audio') {
|
|
374
|
+
let index = (this.ctrl[i] || 0) + 1
|
|
375
|
+
if (index > node.src.length) {
|
|
376
|
+
index = 0
|
|
377
|
+
}
|
|
378
|
+
if (index < node.src.length) {
|
|
379
|
+
this.$set(this.ctrl, i, index)
|
|
380
|
+
return
|
|
381
|
+
}
|
|
382
|
+
} else if (node.name === 'img') {
|
|
383
|
+
// #ifdef H5 && VUE3
|
|
384
|
+
if (this.opts[0] && !this.ctrl.load) return
|
|
385
|
+
// #endif
|
|
386
|
+
// 显示错误占位图
|
|
387
|
+
if (this.opts[2]) {
|
|
388
|
+
this.$set(this.ctrl, i, -1)
|
|
389
|
+
}
|
|
390
|
+
this.checkReady()
|
|
391
|
+
}
|
|
392
|
+
if (this.root) {
|
|
393
|
+
this.root.$emit('error', {
|
|
394
|
+
source: node.name,
|
|
395
|
+
attrs: node.attrs,
|
|
396
|
+
// #ifndef H5 && VUE3
|
|
397
|
+
errMsg: e.detail.errMsg
|
|
398
|
+
// #endif
|
|
399
|
+
})
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
</script>
|
|
405
|
+
<style>
|
|
406
|
+
/* a 标签默认效果 */
|
|
407
|
+
._a {
|
|
408
|
+
padding: 1.5px 0 1.5px 0;
|
|
409
|
+
color: #366092;
|
|
410
|
+
word-break: break-all;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* a 标签点击态效果 */
|
|
414
|
+
._hover {
|
|
415
|
+
text-decoration: underline;
|
|
416
|
+
opacity: 0.7;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/* 图片默认效果 */
|
|
420
|
+
._img {
|
|
421
|
+
max-width: 100%;
|
|
422
|
+
-webkit-touch-callout: none;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/* 内部样式 */
|
|
426
|
+
|
|
427
|
+
._block {
|
|
428
|
+
display: block;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
._b,
|
|
432
|
+
._strong {
|
|
433
|
+
font-weight: bold;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
._code {
|
|
437
|
+
font-family: monospace;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
._del {
|
|
441
|
+
text-decoration: line-through;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
._em,
|
|
445
|
+
._i {
|
|
446
|
+
font-style: italic;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
._h1 {
|
|
450
|
+
font-size: 2em;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
._h2 {
|
|
454
|
+
font-size: 1.5em;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
._h3 {
|
|
458
|
+
font-size: 1.17em;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
._h5 {
|
|
462
|
+
font-size: 0.83em;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
._h6 {
|
|
466
|
+
font-size: 0.67em;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
._h1,
|
|
470
|
+
._h2,
|
|
471
|
+
._h3,
|
|
472
|
+
._h4,
|
|
473
|
+
._h5,
|
|
474
|
+
._h6 {
|
|
475
|
+
display: block;
|
|
476
|
+
font-weight: bold;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
._image {
|
|
480
|
+
height: 1px;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
._ins {
|
|
484
|
+
text-decoration: underline;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
._li {
|
|
488
|
+
display: list-item;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
._ol {
|
|
492
|
+
list-style-type: decimal;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
._ol,
|
|
496
|
+
._ul {
|
|
497
|
+
display: block;
|
|
498
|
+
padding-left: 40px;
|
|
499
|
+
margin: 1em 0;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
._q::before {
|
|
503
|
+
content: '"';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
._q::after {
|
|
507
|
+
content: '"';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
._sub {
|
|
511
|
+
font-size: smaller;
|
|
512
|
+
vertical-align: sub;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
._sup {
|
|
516
|
+
font-size: smaller;
|
|
517
|
+
vertical-align: super;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
._thead,
|
|
521
|
+
._tbody,
|
|
522
|
+
._tfoot {
|
|
523
|
+
display: table-row-group;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
._tr {
|
|
527
|
+
display: table-row;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
._td,
|
|
531
|
+
._th {
|
|
532
|
+
display: table-cell;
|
|
533
|
+
vertical-align: middle;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
._th {
|
|
537
|
+
font-weight: bold;
|
|
538
|
+
text-align: center;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
._ul {
|
|
542
|
+
list-style-type: disc;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
._ul ._ul {
|
|
546
|
+
margin: 0;
|
|
547
|
+
list-style-type: circle;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
._ul ._ul ._ul {
|
|
551
|
+
list-style-type: square;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
._abbr,
|
|
555
|
+
._b,
|
|
556
|
+
._code,
|
|
557
|
+
._del,
|
|
558
|
+
._em,
|
|
559
|
+
._i,
|
|
560
|
+
._ins,
|
|
561
|
+
._label,
|
|
562
|
+
._q,
|
|
563
|
+
._span,
|
|
564
|
+
._strong,
|
|
565
|
+
._sub,
|
|
566
|
+
._sup {
|
|
567
|
+
display: inline;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/* #ifdef APP-PLUS */
|
|
571
|
+
._video {
|
|
572
|
+
width: 300px;
|
|
573
|
+
height: 225px;
|
|
574
|
+
}
|
|
575
|
+
/* #endif */
|
|
576
|
+
</style>
|