uview-ui-wjf 1.0.0
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/LICENSE +21 -0
- package/README.md +71 -0
- package/changelog.md +388 -0
- package/components/u--form/u--form.vue +92 -0
- package/components/u--image/u--image.vue +73 -0
- package/components/u--input/u--input.vue +115 -0
- package/components/u--text/u--text.vue +72 -0
- package/components/u--textarea/u--textarea.vue +85 -0
- package/components/u-action-sheet/props.js +54 -0
- package/components/u-action-sheet/u-action-sheet.vue +278 -0
- package/components/u-album/props.js +59 -0
- package/components/u-album/u-album.vue +259 -0
- package/components/u-alert/props.js +44 -0
- package/components/u-alert/u-alert.vue +243 -0
- package/components/u-avatar/props.js +78 -0
- package/components/u-avatar/u-avatar.vue +173 -0
- package/components/u-avatar-group/props.js +52 -0
- package/components/u-avatar-group/u-avatar-group.vue +103 -0
- package/components/u-back-top/props.js +54 -0
- package/components/u-back-top/u-back-top.vue +129 -0
- package/components/u-badge/props.js +72 -0
- package/components/u-badge/u-badge.vue +171 -0
- package/components/u-button/nvue.scss +46 -0
- package/components/u-button/props.js +161 -0
- package/components/u-button/u-button.vue +495 -0
- package/components/u-button/vue.scss +80 -0
- package/components/u-calendar/header.vue +99 -0
- package/components/u-calendar/month.vue +579 -0
- package/components/u-calendar/props.js +144 -0
- package/components/u-calendar/u-calendar.vue +384 -0
- package/components/u-calendar/util.js +85 -0
- package/components/u-car-keyboard/props.js +14 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +311 -0
- package/components/u-cell/props.js +110 -0
- package/components/u-cell/u-cell.vue +229 -0
- package/components/u-cell-group/props.js +14 -0
- package/components/u-cell-group/u-cell-group.vue +61 -0
- package/components/u-checkbox/props.js +69 -0
- package/components/u-checkbox/u-checkbox.vue +344 -0
- package/components/u-checkbox-group/props.js +82 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +103 -0
- package/components/u-circle-progress/props.js +8 -0
- package/components/u-circle-progress/u-circle-progress.vue +198 -0
- package/components/u-code/props.js +34 -0
- package/components/u-code/u-code.vue +129 -0
- package/components/u-code-input/props.js +79 -0
- package/components/u-code-input/u-code-input.vue +252 -0
- package/components/u-col/props.js +29 -0
- package/components/u-col/u-col.vue +162 -0
- package/components/u-collapse/props.js +19 -0
- package/components/u-collapse/u-collapse.vue +90 -0
- package/components/u-collapse-item/props.js +59 -0
- package/components/u-collapse-item/u-collapse-item.vue +225 -0
- package/components/u-column-notice/props.js +55 -0
- package/components/u-column-notice/u-column-notice.vue +160 -0
- package/components/u-count-down/props.js +24 -0
- package/components/u-count-down/u-count-down.vue +163 -0
- package/components/u-count-down/utils.js +62 -0
- package/components/u-count-to/props.js +59 -0
- package/components/u-count-to/u-count-to.vue +184 -0
- package/components/u-datetime-picker/props.js +120 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +361 -0
- package/components/u-divider/props.js +44 -0
- package/components/u-divider/u-divider.vue +116 -0
- package/components/u-dropdown/props.js +65 -0
- package/components/u-dropdown/u-dropdown.vue +127 -0
- package/components/u-dropdown-item/props.js +36 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +127 -0
- package/components/u-empty/props.js +59 -0
- package/components/u-empty/u-empty.vue +128 -0
- package/components/u-form/props.js +45 -0
- package/components/u-form/u-form.vue +214 -0
- package/components/u-form-item/props.js +48 -0
- package/components/u-form-item/u-form-item.vue +235 -0
- package/components/u-gap/props.js +24 -0
- package/components/u-gap/u-gap.vue +38 -0
- package/components/u-grid/props.js +19 -0
- package/components/u-grid/u-grid.vue +97 -0
- package/components/u-grid-item/props.js +14 -0
- package/components/u-grid-item/u-grid-item.vue +209 -0
- package/components/u-icon/icons.js +214 -0
- package/components/u-icon/props.js +89 -0
- package/components/u-icon/u-icon.vue +237 -0
- package/components/u-image/props.js +84 -0
- package/components/u-image/u-image.vue +232 -0
- package/components/u-index-anchor/props.js +29 -0
- package/components/u-index-anchor/u-index-anchor.vue +91 -0
- package/components/u-index-item/props.js +5 -0
- package/components/u-index-item/u-index-item.vue +87 -0
- package/components/u-index-list/props.js +29 -0
- package/components/u-index-list/u-index-list.vue +440 -0
- package/components/u-input/props.js +187 -0
- package/components/u-input/u-input.vue +369 -0
- package/components/u-keyboard/props.js +84 -0
- package/components/u-keyboard/u-keyboard.vue +164 -0
- package/components/u-line/props.js +33 -0
- package/components/u-line/u-line.vue +62 -0
- package/components/u-line-progress/props.js +28 -0
- package/components/u-line-progress/u-line-progress.vue +144 -0
- package/components/u-link/props.js +39 -0
- package/components/u-link/u-link.vue +83 -0
- package/components/u-list/props.js +76 -0
- package/components/u-list/u-list.vue +157 -0
- package/components/u-list-item/props.js +9 -0
- package/components/u-list-item/u-list-item.vue +116 -0
- package/components/u-loading-icon/props.js +59 -0
- package/components/u-loading-icon/u-loading-icon.vue +343 -0
- package/components/u-loading-page/props.js +49 -0
- package/components/u-loading-page/u-loading-page.vue +115 -0
- package/components/u-loadmore/props.js +94 -0
- package/components/u-loadmore/u-loadmore.vue +150 -0
- package/components/u-modal/props.js +89 -0
- package/components/u-modal/u-modal.vue +228 -0
- package/components/u-navbar/props.js +84 -0
- package/components/u-navbar/u-navbar.vue +186 -0
- package/components/u-no-network/props.js +19 -0
- package/components/u-no-network/u-no-network.vue +220 -0
- package/components/u-notice-bar/props.js +70 -0
- package/components/u-notice-bar/u-notice-bar.vue +101 -0
- package/components/u-notify/props.js +49 -0
- package/components/u-notify/u-notify.vue +211 -0
- package/components/u-number-box/props.js +109 -0
- package/components/u-number-box/u-number-box.vue +416 -0
- package/components/u-number-keyboard/props.js +19 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +196 -0
- package/components/u-overlay/props.js +24 -0
- package/components/u-overlay/u-overlay.vue +68 -0
- package/components/u-parse/node/node.vue +499 -0
- package/components/u-parse/parser.js +1075 -0
- package/components/u-parse/props.js +45 -0
- package/components/u-parse/u-parse.vue +366 -0
- package/components/u-picker/props.js +79 -0
- package/components/u-picker/u-picker.vue +286 -0
- package/components/u-picker-column/props.js +5 -0
- package/components/u-picker-column/u-picker-column.vue +27 -0
- package/components/u-popup/props.js +79 -0
- package/components/u-popup/u-popup.vue +304 -0
- package/components/u-radio/props.js +64 -0
- package/components/u-radio/u-radio.vue +339 -0
- package/components/u-radio-group/props.js +85 -0
- package/components/u-radio-group/u-radio-group.vue +108 -0
- package/components/u-rate/props.js +69 -0
- package/components/u-rate/u-rate.vue +306 -0
- package/components/u-read-more/props.js +61 -0
- package/components/u-read-more/u-read-more.vue +157 -0
- package/components/u-row/props.js +19 -0
- package/components/u-row/u-row.vue +93 -0
- package/components/u-row-notice/props.js +39 -0
- package/components/u-row-notice/u-row-notice.vue +330 -0
- package/components/u-safe-bottom/props.js +5 -0
- package/components/u-safe-bottom/u-safe-bottom.vue +56 -0
- package/components/u-scroll-list/nvue.js +28 -0
- package/components/u-scroll-list/other.js +0 -0
- package/components/u-scroll-list/props.js +34 -0
- package/components/u-scroll-list/scrollWxs.wxs +50 -0
- package/components/u-scroll-list/u-scroll-list.vue +224 -0
- package/components/u-search/props.js +118 -0
- package/components/u-search/u-search.vue +303 -0
- package/components/u-skeleton/props.js +59 -0
- package/components/u-skeleton/u-skeleton.vue +244 -0
- package/components/u-slider/mpother.js +113 -0
- package/components/u-slider/mpwxs.js +42 -0
- package/components/u-slider/mpwxs.wxs +121 -0
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +180 -0
- package/components/u-slider/nvue.js +193 -0
- package/components/u-slider/props.js +54 -0
- package/components/u-slider/u-slider.vue +55 -0
- package/components/u-status-bar/props.js +8 -0
- package/components/u-status-bar/u-status-bar.vue +46 -0
- package/components/u-steps/props.js +39 -0
- package/components/u-steps/u-steps.vue +80 -0
- package/components/u-steps-item/props.js +24 -0
- package/components/u-steps-item/u-steps-item.vue +316 -0
- package/components/u-sticky/props.js +40 -0
- package/components/u-sticky/u-sticky.vue +212 -0
- package/components/u-subsection/props.js +49 -0
- package/components/u-subsection/u-subsection.vue +299 -0
- package/components/u-swipe-action/props.js +9 -0
- package/components/u-swipe-action/u-swipe-action.vue +67 -0
- package/components/u-swipe-action-item/index - backup.wxs +256 -0
- package/components/u-swipe-action-item/index.wxs +225 -0
- package/components/u-swipe-action-item/nvue - backup.js +270 -0
- package/components/u-swipe-action-item/nvue.js +174 -0
- package/components/u-swipe-action-item/props.js +41 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +190 -0
- package/components/u-swipe-action-item/wxs.js +15 -0
- package/components/u-swiper/props.js +125 -0
- package/components/u-swiper/u-swiper.vue +255 -0
- package/components/u-swiper-indicator/props.js +29 -0
- package/components/u-swiper-indicator/u-swiper-indicator.vue +110 -0
- package/components/u-switch/props.js +54 -0
- package/components/u-switch/u-switch.vue +177 -0
- package/components/u-tabbar/props.js +44 -0
- package/components/u-tabbar/u-tabbar.vue +141 -0
- package/components/u-tabbar-item/props.js +35 -0
- package/components/u-tabbar-item/u-tabbar-item.vue +142 -0
- package/components/u-table/props.js +5 -0
- package/components/u-table/u-table.vue +29 -0
- package/components/u-tabs/props.js +64 -0
- package/components/u-tabs/u-tabs.vue +363 -0
- package/components/u-tabs-item/props.js +5 -0
- package/components/u-tabs-item/u-tabs-item.vue +29 -0
- package/components/u-tag/props.js +84 -0
- package/components/u-tag/u-tag.vue +358 -0
- package/components/u-td/props.js +5 -0
- package/components/u-td/u-td.vue +31 -0
- package/components/u-text/props.js +110 -0
- package/components/u-text/u-text.vue +223 -0
- package/components/u-text/value.js +85 -0
- package/components/u-textarea/props.js +119 -0
- package/components/u-textarea/u-textarea.vue +239 -0
- package/components/u-toast/u-toast.vue +291 -0
- package/components/u-toolbar/props.js +34 -0
- package/components/u-toolbar/u-toolbar.vue +102 -0
- package/components/u-tooltip/clipboard.min.js +58 -0
- package/components/u-tooltip/props.js +59 -0
- package/components/u-tooltip/u-tooltip.vue +366 -0
- package/components/u-tr/props.js +5 -0
- package/components/u-tr/u-tr.vue +31 -0
- package/components/u-transition/nvue.ani-map.js +68 -0
- package/components/u-transition/props.js +24 -0
- package/components/u-transition/transition.js +157 -0
- package/components/u-transition/u-transition.vue +92 -0
- package/components/u-transition/vue.ani-style.scss +113 -0
- package/components/u-upload/mixin.js +21 -0
- package/components/u-upload/props.js +124 -0
- package/components/u-upload/u-upload.vue +566 -0
- package/components/u-upload/utils.js +151 -0
- package/components/uview-ui/uview-ui.vue +15 -0
- package/index.js +79 -0
- package/index.scss +23 -0
- package/libs/config/color.js +17 -0
- package/libs/config/config.js +34 -0
- package/libs/config/props/actionSheet.js +25 -0
- package/libs/config/props/album.js +25 -0
- package/libs/config/props/alert.js +22 -0
- package/libs/config/props/avatar.js +28 -0
- package/libs/config/props/avatarGroup.js +23 -0
- package/libs/config/props/backtop.js +27 -0
- package/libs/config/props/badge.js +27 -0
- package/libs/config/props/button.js +42 -0
- package/libs/config/props/calendar.js +42 -0
- package/libs/config/props/carKeyboard.js +15 -0
- package/libs/config/props/cell.js +35 -0
- package/libs/config/props/cellGroup.js +17 -0
- package/libs/config/props/checkbox.js +27 -0
- package/libs/config/props/checkboxGroup.js +29 -0
- package/libs/config/props/circleProgress.js +15 -0
- package/libs/config/props/code.js +21 -0
- package/libs/config/props/codeInput.js +29 -0
- package/libs/config/props/col.js +19 -0
- package/libs/config/props/collapse.js +17 -0
- package/libs/config/props/collapseItem.js +25 -0
- package/libs/config/props/columnNotice.js +24 -0
- package/libs/config/props/countDown.js +18 -0
- package/libs/config/props/countTo.js +25 -0
- package/libs/config/props/datetimePicker.js +37 -0
- package/libs/config/props/divider.js +23 -0
- package/libs/config/props/empty.js +26 -0
- package/libs/config/props/form.js +22 -0
- package/libs/config/props/formItem.js +23 -0
- package/libs/config/props/gap.js +19 -0
- package/libs/config/props/grid.js +17 -0
- package/libs/config/props/gridItem.js +16 -0
- package/libs/config/props/icon.js +36 -0
- package/libs/config/props/image.js +30 -0
- package/libs/config/props/indexAnchor.js +19 -0
- package/libs/config/props/indexList.js +19 -0
- package/libs/config/props/input.js +48 -0
- package/libs/config/props/keyboard.js +30 -0
- package/libs/config/props/line.js +20 -0
- package/libs/config/props/lineProgress.js +19 -0
- package/libs/config/props/link.js +26 -0
- package/libs/config/props/list.js +28 -0
- package/libs/config/props/listItem.js +15 -0
- package/libs/config/props/loadingIcon.js +30 -0
- package/libs/config/props/loadingPage.js +23 -0
- package/libs/config/props/loadmore.js +32 -0
- package/libs/config/props/modal.js +31 -0
- package/libs/config/props/navbar.js +32 -0
- package/libs/config/props/noNetwork.js +18 -0
- package/libs/config/props/noticeBar.js +27 -0
- package/libs/config/props/notify.js +22 -0
- package/libs/config/props/numberBox.js +35 -0
- package/libs/config/props/numberKeyboard.js +17 -0
- package/libs/config/props/overlay.js +18 -0
- package/libs/config/props/parse.js +22 -0
- package/libs/config/props/picker.js +29 -0
- package/libs/config/props/popup.js +29 -0
- package/libs/config/props/radio.js +27 -0
- package/libs/config/props/radioGroup.js +30 -0
- package/libs/config/props/rate.js +26 -0
- package/libs/config/props/readMore.js +22 -0
- package/libs/config/props/row.js +17 -0
- package/libs/config/props/rowNotice.js +21 -0
- package/libs/config/props/scrollList.js +20 -0
- package/libs/config/props/search.js +37 -0
- package/libs/config/props/section.js +24 -0
- package/libs/config/props/skeleton.js +25 -0
- package/libs/config/props/slider.js +25 -0
- package/libs/config/props/statusBar.js +15 -0
- package/libs/config/props/steps.js +21 -0
- package/libs/config/props/stepsItem.js +18 -0
- package/libs/config/props/sticky.js +20 -0
- package/libs/config/props/subsection.js +23 -0
- package/libs/config/props/swipeAction.js +15 -0
- package/libs/config/props/swipeActionItem.js +21 -0
- package/libs/config/props/swiper.js +39 -0
- package/libs/config/props/swipterIndicator.js +19 -0
- package/libs/config/props/switch.js +24 -0
- package/libs/config/props/tabbar.js +22 -0
- package/libs/config/props/tabbarItem.js +20 -0
- package/libs/config/props/tabs.js +32 -0
- package/libs/config/props/tag.js +29 -0
- package/libs/config/props/text.js +38 -0
- package/libs/config/props/textarea.js +36 -0
- package/libs/config/props/toast.js +30 -0
- package/libs/config/props/toolbar.js +21 -0
- package/libs/config/props/tooltip.js +25 -0
- package/libs/config/props/transition.js +18 -0
- package/libs/config/props/upload.js +36 -0
- package/libs/config/props.js +190 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +97 -0
- package/libs/css/components.scss +15 -0
- package/libs/css/flex.scss +257 -0
- package/libs/css/h5.scss +0 -0
- package/libs/css/mixin.scss +8 -0
- package/libs/css/mp.scss +0 -0
- package/libs/css/nvue.scss +0 -0
- package/libs/css/vue.scss +27 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +731 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +288 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +97 -0
- package/libs/luch-request/core/InterceptorManager.js +50 -0
- package/libs/luch-request/core/Request.js +198 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +29 -0
- package/libs/luch-request/core/dispatchRequest.js +3 -0
- package/libs/luch-request/core/mergeConfig.js +103 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +69 -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 +116 -0
- package/libs/luch-request/index.js +3 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +131 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +160 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +25 -0
- package/libs/mixin/style.js +228 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/async-validator.js +1343 -0
- package/libs/util/calendar.js +546 -0
- package/libs/util/dayjs.js +308 -0
- package/libs/util/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/package.json +83 -0
- package/theme.scss +44 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<u-transition
|
|
3
|
+
:show="show"
|
|
4
|
+
custom-class="u-overlay"
|
|
5
|
+
:duration="duration"
|
|
6
|
+
:custom-style="overlayStyle"
|
|
7
|
+
@click="clickHandler"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</u-transition>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import props from './props.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* overlay 遮罩
|
|
18
|
+
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
|
|
19
|
+
* @tutorial https://www.uviewui.com/components/overlay.html
|
|
20
|
+
* @property {Boolean} show 是否显示遮罩(默认 false )
|
|
21
|
+
* @property {String | Number} zIndex zIndex 层级(默认 10070 )
|
|
22
|
+
* @property {String | Number} duration 动画时长,单位毫秒(默认 300 )
|
|
23
|
+
* @property {String | Number} opacity 不透明度值,当做rgba的第四个参数 (默认 0.5 )
|
|
24
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
25
|
+
* @event {Function} click 点击遮罩发送事件
|
|
26
|
+
* @example <u-overlay :show="show" @click="show = false"></u-overlay>
|
|
27
|
+
*/
|
|
28
|
+
export default {
|
|
29
|
+
name: "u-overlay",
|
|
30
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
|
|
31
|
+
computed: {
|
|
32
|
+
overlayStyle() {
|
|
33
|
+
const style = {
|
|
34
|
+
position: 'fixed',
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
zIndex: this.zIndex,
|
|
39
|
+
bottom: 0,
|
|
40
|
+
'background-color': `rgba(0, 0, 0, ${this.opacity})`
|
|
41
|
+
}
|
|
42
|
+
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
clickHandler() {
|
|
47
|
+
this.$emit('click')
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss" scoped>
|
|
54
|
+
@import "../../libs/css/components.scss";
|
|
55
|
+
$u-overlay-top:0 !default;
|
|
56
|
+
$u-overlay-left:0 !default;
|
|
57
|
+
$u-overlay-width:100% !default;
|
|
58
|
+
$u-overlay-height:100% !default;
|
|
59
|
+
$u-overlay-background-color:rgba(0, 0, 0, .7) !default;
|
|
60
|
+
.u-overlay {
|
|
61
|
+
position: fixed;
|
|
62
|
+
top:$u-overlay-top;
|
|
63
|
+
left:$u-overlay-left;
|
|
64
|
+
width: $u-overlay-width;
|
|
65
|
+
height:$u-overlay-height;
|
|
66
|
+
background-color:$u-overlay-background-color;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :id="attrs.id" :class="'_'+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'&&((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 -->
|
|
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 -->
|
|
12
|
+
<image v-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'" :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" />
|
|
13
|
+
<!-- #endif -->
|
|
14
|
+
<!-- 文本 -->
|
|
15
|
+
<!-- #ifndef MP-BAIDU -->
|
|
16
|
+
<text v-else-if="n.type=='text'" decode>{{n.text}}</text>
|
|
17
|
+
<!-- #endif -->
|
|
18
|
+
<text v-else-if="n.name=='br'">\n</text>
|
|
19
|
+
<!-- 链接 -->
|
|
20
|
+
<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">
|
|
21
|
+
<node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
|
|
22
|
+
</view>
|
|
23
|
+
<!-- 视频 -->
|
|
24
|
+
<!-- #ifdef APP-PLUS -->
|
|
25
|
+
<view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" />
|
|
26
|
+
<!-- #endif -->
|
|
27
|
+
<!-- #ifndef APP-PLUS -->
|
|
28
|
+
<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" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
|
|
29
|
+
<!-- #endif -->
|
|
30
|
+
<!-- #ifdef H5 || APP-PLUS -->
|
|
31
|
+
<iframe v-else-if="n.name=='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" />
|
|
32
|
+
<embed v-else-if="n.name=='embed'" :style="n.attrs.style" :src="n.attrs.src" />
|
|
33
|
+
<!-- #endif -->
|
|
34
|
+
<!-- #ifndef MP-TOUTIAO -->
|
|
35
|
+
<!-- 音频 -->
|
|
36
|
+
<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" />
|
|
37
|
+
<!-- #endif -->
|
|
38
|
+
<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">
|
|
39
|
+
<node v-if="n.name=='li'" :childs="n.children" :opts="opts" />
|
|
40
|
+
<view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style">
|
|
41
|
+
<node v-if="tbody.name=='td'||tbody.name=='th'" :childs="tbody.children" :opts="opts" />
|
|
42
|
+
<block v-else v-for="(tr, y) in tbody.children" v-bind:key="y">
|
|
43
|
+
<view v-if="tr.name=='td'||tr.name=='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
|
|
44
|
+
<node :childs="tr.children" :opts="opts" />
|
|
45
|
+
</view>
|
|
46
|
+
<view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
|
|
47
|
+
<view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style">
|
|
48
|
+
<node :childs="td.children" :opts="opts" />
|
|
49
|
+
</view>
|
|
50
|
+
</view>
|
|
51
|
+
</block>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
|
|
55
|
+
<!-- 富文本 -->
|
|
56
|
+
<!-- #ifdef H5 || MP-WEIXIN || MP-QQ || APP-PLUS || MP-360 -->
|
|
57
|
+
<rich-text v-else-if="handler.use(n)" :id="n.attrs.id" :style="n.f" :nodes="[n]" />
|
|
58
|
+
<!-- #endif -->
|
|
59
|
+
<!-- #ifndef H5 || MP-WEIXIN || MP-QQ || APP-PLUS || MP-360 -->
|
|
60
|
+
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="n.f+';display:inline'" :preview="false" :nodes="[n]" />
|
|
61
|
+
<!-- #endif -->
|
|
62
|
+
<!-- 继续递归 -->
|
|
63
|
+
<view v-else-if="n.c==2" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
|
|
64
|
+
<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" />
|
|
65
|
+
</view>
|
|
66
|
+
<node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" />
|
|
67
|
+
</block>
|
|
68
|
+
</view>
|
|
69
|
+
</template>
|
|
70
|
+
<script module="handler" lang="wxs">
|
|
71
|
+
// 行内标签列表
|
|
72
|
+
var inlineTags = {
|
|
73
|
+
abbr: true,
|
|
74
|
+
b: true,
|
|
75
|
+
big: true,
|
|
76
|
+
code: true,
|
|
77
|
+
del: true,
|
|
78
|
+
em: true,
|
|
79
|
+
i: true,
|
|
80
|
+
ins: true,
|
|
81
|
+
label: true,
|
|
82
|
+
q: true,
|
|
83
|
+
small: true,
|
|
84
|
+
span: true,
|
|
85
|
+
strong: true,
|
|
86
|
+
sub: true,
|
|
87
|
+
sup: true
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @description 是否使用 rich-text 显示剩余内容
|
|
91
|
+
*/
|
|
92
|
+
module.exports = {
|
|
93
|
+
use: function (item) {
|
|
94
|
+
// 微信和 QQ 的 rich-text inline 布局无效
|
|
95
|
+
if (inlineTags[item.name] || (item.attrs.style || '').indexOf('display:inline') != -1)
|
|
96
|
+
return false
|
|
97
|
+
return !item.c
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
<script>
|
|
102
|
+
|
|
103
|
+
import node from './node'
|
|
104
|
+
export default {
|
|
105
|
+
name: 'node',
|
|
106
|
+
// #ifdef MP-WEIXIN
|
|
107
|
+
options: {
|
|
108
|
+
virtualHost: true
|
|
109
|
+
},
|
|
110
|
+
// #endif
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
ctrl: {}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
props: {
|
|
117
|
+
name: String,
|
|
118
|
+
attrs: {
|
|
119
|
+
type: Object,
|
|
120
|
+
default() {
|
|
121
|
+
return {}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
childs: Array,
|
|
125
|
+
opts: Array
|
|
126
|
+
},
|
|
127
|
+
components: {
|
|
128
|
+
|
|
129
|
+
node
|
|
130
|
+
},
|
|
131
|
+
mounted() {
|
|
132
|
+
for (this.root = this.$parent; this.root.$options.name != 'mp-html'; this.root = this.root.$parent);
|
|
133
|
+
// #ifdef H5 || APP-PLUS
|
|
134
|
+
if (this.opts[0]) {
|
|
135
|
+
for (var i = this.childs.length; i--;)
|
|
136
|
+
if (this.childs[i].name == 'img')
|
|
137
|
+
break
|
|
138
|
+
if (i != -1) {
|
|
139
|
+
this.observer = uni.createIntersectionObserver(this).relativeToViewport({
|
|
140
|
+
top: 500,
|
|
141
|
+
bottom: 500
|
|
142
|
+
})
|
|
143
|
+
this.observer.observe('._img', res => {
|
|
144
|
+
if (res.intersectionRatio) {
|
|
145
|
+
this.$set(this.ctrl, 'load', 1)
|
|
146
|
+
this.observer.disconnect()
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// #endif
|
|
152
|
+
},
|
|
153
|
+
beforeDestroy() {
|
|
154
|
+
// #ifdef H5 || APP-PLUS
|
|
155
|
+
if (this.observer)
|
|
156
|
+
this.observer.disconnect()
|
|
157
|
+
// #endif
|
|
158
|
+
},
|
|
159
|
+
methods:{
|
|
160
|
+
// #ifdef MP-WEIXIN
|
|
161
|
+
toJSON() { },
|
|
162
|
+
// #endif
|
|
163
|
+
/**
|
|
164
|
+
* @description 播放视频事件
|
|
165
|
+
* @param {Event} e
|
|
166
|
+
*/
|
|
167
|
+
play(e) {
|
|
168
|
+
// #ifndef APP-PLUS
|
|
169
|
+
if (this.root.pauseVideo) {
|
|
170
|
+
var flag = false, id = e.target.id
|
|
171
|
+
for (var i = this.root._videos.length; i--;) {
|
|
172
|
+
if (this.root._videos[i].id == id)
|
|
173
|
+
flag = true
|
|
174
|
+
else
|
|
175
|
+
this.root._videos[i].pause() // 自动暂停其他视频
|
|
176
|
+
}
|
|
177
|
+
// 将自己加入列表
|
|
178
|
+
if (!flag) {
|
|
179
|
+
var ctx = uni.createVideoContext(id
|
|
180
|
+
// #ifndef MP-BAIDU
|
|
181
|
+
, this
|
|
182
|
+
// #endif
|
|
183
|
+
)
|
|
184
|
+
ctx.id = id
|
|
185
|
+
this.root._videos.push(ctx)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// #endif
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @description 图片点击事件
|
|
193
|
+
* @param {Event} e
|
|
194
|
+
*/
|
|
195
|
+
imgTap(e) {
|
|
196
|
+
var node = this.childs[e.currentTarget.dataset.i]
|
|
197
|
+
if (node.a)
|
|
198
|
+
return this.linkTap(node.a)
|
|
199
|
+
if (node.attrs.ignore)
|
|
200
|
+
return
|
|
201
|
+
// #ifdef H5 || APP-PLUS
|
|
202
|
+
node.attrs.src = node.attrs.src || node.attrs['data-src']
|
|
203
|
+
// #endif
|
|
204
|
+
this.root.$emit('imgTap', node.attrs)
|
|
205
|
+
// 自动预览图片
|
|
206
|
+
if (this.root.previewImg)
|
|
207
|
+
uni.previewImage({
|
|
208
|
+
current: parseInt(node.attrs.i),
|
|
209
|
+
urls: this.root.imgList
|
|
210
|
+
})
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @description 图片长按
|
|
215
|
+
*/
|
|
216
|
+
imgLongTap(e) {
|
|
217
|
+
// #ifdef APP-PLUS
|
|
218
|
+
var attrs = this.childs[e.currentTarget.dataset.i].attrs
|
|
219
|
+
if (!attrs.ignore)
|
|
220
|
+
uni.showActionSheet({
|
|
221
|
+
itemList: ['保存图片'],
|
|
222
|
+
success: () => {
|
|
223
|
+
uni.downloadFile({
|
|
224
|
+
url: this.root.imgList[attrs.i],
|
|
225
|
+
success: res => {
|
|
226
|
+
uni.saveImageToPhotosAlbum({
|
|
227
|
+
filePath: res.tempFilePath,
|
|
228
|
+
success() {
|
|
229
|
+
uni.showToast({
|
|
230
|
+
title: '保存成功'
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
// #endif
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @description 图片加载完成事件
|
|
243
|
+
* @param {Event} e
|
|
244
|
+
*/
|
|
245
|
+
imgLoad(e) {
|
|
246
|
+
var i = e.currentTarget.dataset.i
|
|
247
|
+
// #ifndef H5 || APP-PLUS
|
|
248
|
+
// 设置原宽度
|
|
249
|
+
if (!this.childs[i].w)
|
|
250
|
+
this.$set(this.ctrl, i, e.detail.width)
|
|
251
|
+
else
|
|
252
|
+
// #endif
|
|
253
|
+
// 加载完毕,取消加载中占位图
|
|
254
|
+
if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] == -1)
|
|
255
|
+
this.$set(this.ctrl, i, 1)
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @description 链接点击事件
|
|
260
|
+
* @param {Event} e
|
|
261
|
+
*/
|
|
262
|
+
linkTap(e) {
|
|
263
|
+
var attrs = e.currentTarget ? this.childs[e.currentTarget.dataset.i].attrs : e,
|
|
264
|
+
href = attrs.href
|
|
265
|
+
this.root.$emit('linkTap', attrs)
|
|
266
|
+
if (href) {
|
|
267
|
+
// 跳转锚点
|
|
268
|
+
if (href[0] == '#')
|
|
269
|
+
this.root.navigateTo(href.substring(1)).catch(() => { })
|
|
270
|
+
// 复制外部链接
|
|
271
|
+
else if (href.includes('://')) {
|
|
272
|
+
if (this.root.copyLink) {
|
|
273
|
+
// #ifdef H5
|
|
274
|
+
window.open(href)
|
|
275
|
+
// #endif
|
|
276
|
+
// #ifdef MP
|
|
277
|
+
uni.setClipboardData({
|
|
278
|
+
data: href,
|
|
279
|
+
success: () =>
|
|
280
|
+
uni.showToast({
|
|
281
|
+
title: '链接已复制'
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
// #endif
|
|
285
|
+
// #ifdef APP-PLUS
|
|
286
|
+
plus.runtime.openWeb(href)
|
|
287
|
+
// #endif
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// 跳转页面
|
|
291
|
+
else
|
|
292
|
+
uni.navigateTo({
|
|
293
|
+
url: href,
|
|
294
|
+
fail() {
|
|
295
|
+
uni.switchTab({
|
|
296
|
+
url: href,
|
|
297
|
+
fail() { }
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @description 错误事件
|
|
306
|
+
* @param {Event} e
|
|
307
|
+
*/
|
|
308
|
+
mediaError(e) {
|
|
309
|
+
var i = e.currentTarget.dataset.i,
|
|
310
|
+
node = this.childs[i]
|
|
311
|
+
// 加载其他源
|
|
312
|
+
if (node.name == 'video' || node.name == 'audio') {
|
|
313
|
+
var index = (this.ctrl[i] || 0) + 1
|
|
314
|
+
if (index > node.src.length)
|
|
315
|
+
index = 0
|
|
316
|
+
if (index < node.src.length)
|
|
317
|
+
return this.$set(this.ctrl, i, index)
|
|
318
|
+
}
|
|
319
|
+
// 显示错误占位图
|
|
320
|
+
else if (node.name == 'img' && this.opts[2])
|
|
321
|
+
this.$set(this.ctrl, i, -1)
|
|
322
|
+
if (this.root)
|
|
323
|
+
this.root.$emit('error', {
|
|
324
|
+
source: node.name,
|
|
325
|
+
attrs: node.attrs,
|
|
326
|
+
errMsg: e.detail.errMsg
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
</script>
|
|
332
|
+
<style>
|
|
333
|
+
/* a 标签默认效果 */
|
|
334
|
+
._a {
|
|
335
|
+
padding: 1.5px 0 1.5px 0;
|
|
336
|
+
color: #366092;
|
|
337
|
+
word-break: break-all;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* a 标签点击态效果 */
|
|
341
|
+
._hover {
|
|
342
|
+
text-decoration: underline;
|
|
343
|
+
opacity: 0.7;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* 图片默认效果 */
|
|
347
|
+
._img {
|
|
348
|
+
max-width: 100%;
|
|
349
|
+
-webkit-touch-callout: none;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* 内部样式 */
|
|
353
|
+
|
|
354
|
+
._b,
|
|
355
|
+
._strong {
|
|
356
|
+
font-weight: bold;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
._code {
|
|
360
|
+
font-family: monospace;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
._del {
|
|
364
|
+
text-decoration: line-through;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
._em,
|
|
368
|
+
._i {
|
|
369
|
+
font-style: italic;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
._h1 {
|
|
373
|
+
font-size: 2em;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
._h2 {
|
|
377
|
+
font-size: 1.5em;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
._h3 {
|
|
381
|
+
font-size: 1.17em;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
._h5 {
|
|
385
|
+
font-size: 0.83em;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
._h6 {
|
|
389
|
+
font-size: 0.67em;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
._h1,
|
|
393
|
+
._h2,
|
|
394
|
+
._h3,
|
|
395
|
+
._h4,
|
|
396
|
+
._h5,
|
|
397
|
+
._h6 {
|
|
398
|
+
display: block;
|
|
399
|
+
font-weight: bold;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
._image {
|
|
403
|
+
height: 1px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
._ins {
|
|
407
|
+
text-decoration: underline;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
._li {
|
|
411
|
+
display: list-item;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
._ol {
|
|
415
|
+
list-style-type: decimal;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
._ol,
|
|
419
|
+
._ul {
|
|
420
|
+
display: block;
|
|
421
|
+
padding-left: 40px;
|
|
422
|
+
margin: 1em 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
._q::before {
|
|
426
|
+
content: '"';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
._q::after {
|
|
430
|
+
content: '"';
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
._sub {
|
|
434
|
+
font-size: smaller;
|
|
435
|
+
vertical-align: sub;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
._sup {
|
|
439
|
+
font-size: smaller;
|
|
440
|
+
vertical-align: super;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
._thead,
|
|
444
|
+
._tbody,
|
|
445
|
+
._tfoot {
|
|
446
|
+
display: table-row-group;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
._tr {
|
|
450
|
+
display: table-row;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
._td,
|
|
454
|
+
._th {
|
|
455
|
+
display: table-cell;
|
|
456
|
+
vertical-align: middle;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
._th {
|
|
460
|
+
font-weight: bold;
|
|
461
|
+
text-align: center;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
._ul {
|
|
465
|
+
list-style-type: disc;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
._ul ._ul {
|
|
469
|
+
margin: 0;
|
|
470
|
+
list-style-type: circle;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
._ul ._ul ._ul {
|
|
474
|
+
list-style-type: square;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
._abbr,
|
|
478
|
+
._b,
|
|
479
|
+
._code,
|
|
480
|
+
._del,
|
|
481
|
+
._em,
|
|
482
|
+
._i,
|
|
483
|
+
._ins,
|
|
484
|
+
._label,
|
|
485
|
+
._q,
|
|
486
|
+
._span,
|
|
487
|
+
._strong,
|
|
488
|
+
._sub,
|
|
489
|
+
._sup {
|
|
490
|
+
display: inline;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/* #ifdef APP-PLUS */
|
|
494
|
+
._video {
|
|
495
|
+
width: 300px;
|
|
496
|
+
height: 225px;
|
|
497
|
+
}
|
|
498
|
+
/* #endif */
|
|
499
|
+
</style>
|