uview-pro 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +6 -0
- package/components/u-action-sheet/u-action-sheet.vue +205 -0
- package/components/u-alert-tips/u-alert-tips.vue +241 -0
- package/components/u-avatar/u-avatar.vue +220 -0
- package/components/u-avatar-cropper/u-avatar-cropper.vue +329 -0
- package/components/u-avatar-cropper/weCropper.d.ts +54 -0
- package/components/u-avatar-cropper/weCropper.js +1267 -0
- package/components/u-avatar-cropper/weCropper.ts +1254 -0
- package/components/u-back-top/u-back-top.vue +156 -0
- package/components/u-badge/u-badge.vue +189 -0
- package/components/u-button/u-button.vue +562 -0
- package/components/u-calendar/u-calendar.vue +725 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +236 -0
- package/components/u-card/u-card.vue +240 -0
- package/components/u-cell-group/u-cell-group.vue +56 -0
- package/components/u-cell-item/u-cell-item.vue +245 -0
- package/components/u-checkbox/u-checkbox.vue +310 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +134 -0
- package/components/u-circle-progress/u-circle-progress.vue +210 -0
- package/components/u-col/u-col.vue +135 -0
- package/components/u-collapse/u-collapse.vue +82 -0
- package/components/u-collapse-item/u-collapse-item.vue +190 -0
- package/components/u-column-notice/u-column-notice.vue +264 -0
- package/components/u-count-down/u-count-down.vue +333 -0
- package/components/u-count-to/u-count-to.vue +297 -0
- package/components/u-divider/u-divider.vue +141 -0
- package/components/u-dropdown/u-dropdown.vue +311 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +135 -0
- package/components/u-empty/u-empty.vue +111 -0
- package/components/u-field/u-field.vue +469 -0
- package/components/u-form/u-form.vue +162 -0
- package/components/u-form-item/u-form-item.vue +476 -0
- package/components/u-full-screen/u-full-screen.vue +80 -0
- package/components/u-gap/u-gap.vue +48 -0
- package/components/u-grid/u-grid.vue +101 -0
- package/components/u-grid-item/u-grid-item.vue +136 -0
- package/components/u-icon/u-icon.vue +389 -0
- package/components/u-image/types.ts +48 -0
- package/components/u-image/u-image.vue +218 -0
- package/components/u-index-anchor/u-index-anchor.vue +101 -0
- package/components/u-index-list/u-index-list.vue +376 -0
- package/components/u-input/u-input.vue +462 -0
- package/components/u-keyboard/u-keyboard.vue +188 -0
- package/components/u-lazy-load/u-lazy-load.vue +288 -0
- package/components/u-line/u-line.vue +71 -0
- package/components/u-line-progress/u-line-progress.vue +128 -0
- package/components/u-link/u-link.vue +87 -0
- package/components/u-loading/u-loading.vue +111 -0
- package/components/u-loadmore/u-loadmore.vue +205 -0
- package/components/u-mask/u-mask.vue +137 -0
- package/components/u-message-input/u-message-input.vue +315 -0
- package/components/u-modal/u-modal.vue +284 -0
- package/components/u-navbar/u-navbar.vue +314 -0
- package/components/u-no-network/image.ts +2 -0
- package/components/u-no-network/u-no-network.vue +311 -0
- package/components/u-notice-bar/u-notice-bar.vue +274 -0
- package/components/u-number-box/u-number-box.vue +344 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +170 -0
- package/components/u-parse/libs/CssHandler.js +100 -0
- package/components/u-parse/libs/MpHtmlParser.js +580 -0
- package/components/u-parse/libs/config.js +80 -0
- package/components/u-parse/libs/handler.wxs +22 -0
- package/components/u-parse/libs/trees.vue +505 -0
- package/components/u-parse/u-parse.vue +645 -0
- package/components/u-picker/u-picker.vue +808 -0
- package/components/u-popup/u-popup.vue +404 -0
- package/components/u-radio/u-radio.vue +272 -0
- package/components/u-radio-group/u-radio-group.vue +116 -0
- package/components/u-rate/u-rate.vue +349 -0
- package/components/u-read-more/u-read-more.vue +199 -0
- package/components/u-row/u-row.vue +95 -0
- package/components/u-row-notice/u-row-notice.vue +273 -0
- package/components/u-search/u-search.vue +298 -0
- package/components/u-section/u-section.vue +175 -0
- package/components/u-select/u-select.vue +387 -0
- package/components/u-skeleton/u-skeleton.vue +230 -0
- package/components/u-slider/u-slider.vue +293 -0
- package/components/u-steps/u-steps.vue +200 -0
- package/components/u-sticky/u-sticky.vue +189 -0
- package/components/u-subsection/u-subsection.vue +388 -0
- package/components/u-swipe-action/u-swipe-action.vue +289 -0
- package/components/u-swiper/u-swiper.vue +305 -0
- package/components/u-switch/u-switch.vue +146 -0
- package/components/u-tabbar/u-tabbar.vue +347 -0
- package/components/u-table/u-table.vue +104 -0
- package/components/u-tabs/u-tabs.vue +322 -0
- package/components/u-tabs-swiper/u-tabs-swiper.vue +426 -0
- package/components/u-tag/u-tag.vue +270 -0
- package/components/u-td/u-td.vue +76 -0
- package/components/u-th/u-th.vue +70 -0
- package/components/u-time-line/u-time-line.vue +39 -0
- package/components/u-time-line-item/u-time-line-item.vue +88 -0
- package/components/u-toast/types.ts +4 -0
- package/components/u-toast/u-toast.vue +238 -0
- package/components/u-top-tips/u-top-tips.vue +118 -0
- package/components/u-tr/u-tr.vue +24 -0
- package/components/u-upload/u-upload.vue +600 -0
- package/components/u-verification-code/u-verification-code.vue +194 -0
- package/components/u-waterfall/u-waterfall.vue +186 -0
- package/iconfont.css +910 -0
- package/index.scss +23 -0
- package/index.ts +166 -0
- package/libs/config/config.ts +26 -0
- package/libs/config/zIndex.ts +37 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +176 -0
- package/libs/css/style.components.scss +7 -0
- package/libs/css/style.h5.scss +8 -0
- package/libs/css/style.mp.scss +72 -0
- package/libs/css/style.nvue.scss +3 -0
- package/libs/css/style.vue.scss +175 -0
- package/libs/function/$parent.ts +22 -0
- package/libs/function/addUnit.ts +13 -0
- package/libs/function/color.ts +37 -0
- package/libs/function/colorGradient.ts +123 -0
- package/libs/function/debounce.ts +28 -0
- package/libs/function/deepClone.ts +39 -0
- package/libs/function/deepMerge.ts +34 -0
- package/libs/function/getParent.ts +59 -0
- package/libs/function/getRect.ts +26 -0
- package/libs/function/guid.ts +42 -0
- package/libs/function/md5.ts +397 -0
- package/libs/function/parent.ts +21 -0
- package/libs/function/queryParams.ts +60 -0
- package/libs/function/random.ts +16 -0
- package/libs/function/randomArray.ts +11 -0
- package/libs/function/route.ts +118 -0
- package/libs/function/sys.ts +15 -0
- package/libs/function/test.ts +229 -0
- package/libs/function/throttle.ts +31 -0
- package/libs/function/timeFormat.ts +54 -0
- package/libs/function/timeFrom.ts +48 -0
- package/libs/function/toast.ts +14 -0
- package/libs/function/trim.ts +21 -0
- package/libs/function/type2icon.ts +36 -0
- package/libs/hooks/useEmitter.ts +77 -0
- package/libs/hooks/useParent.ts +29 -0
- package/libs/request/index.ts +237 -0
- package/libs/store/index.ts +88 -0
- package/libs/util/area.ts +1 -0
- package/libs/util/async-validator.js +1356 -0
- package/libs/util/city.ts +1 -0
- package/libs/util/emitter.ts +112 -0
- package/libs/util/mitt.ts +118 -0
- package/libs/util/parent.ts +20 -0
- package/libs/util/province.ts +1 -0
- package/package.json +98 -0
- package/readme.md +165 -0
- package/theme.scss +38 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="'interlayer '+(c||'')" :style="s">
|
|
3
|
+
<block v-for="(n, i) in nodes" v-bind:key="i">
|
|
4
|
+
<!--图片-->
|
|
5
|
+
<view v-if="n.name=='img'" :class="'_img '+n.attrs.class" :style="n.attrs.style" :data-attrs="n.attrs" @tap.stop="imgtap">
|
|
6
|
+
<rich-text v-if="ctrl[i]!=0" :nodes="[{attrs:{src:loading&&(ctrl[i]||0)<2?loading:(lazyLoad&&!ctrl[i]?placeholder:(ctrl[i]==3?errorImg:n.attrs.src||'')),alt:n.attrs.alt||'',width:n.attrs.width||'',style:'-webkit-touch-callout:none;max-width:100%;display:block'+(n.attrs.height?';height:'+n.attrs.height:'')},name:'img'}]" />
|
|
7
|
+
<image class="_image" :src="lazyLoad&&!ctrl[i]?placeholder:n.attrs.src" :lazy-load="lazyLoad"
|
|
8
|
+
:show-menu-by-longpress="!n.attrs.ignore" :data-i="i" :data-index="n.attrs.i" data-source="img" @load="loadImg"
|
|
9
|
+
@error="error" />
|
|
10
|
+
</view>
|
|
11
|
+
<!--文本-->
|
|
12
|
+
<text v-else-if="n.type=='text'" decode>{{n.text}}</text>
|
|
13
|
+
<!--#ifndef MP-BAIDU-->
|
|
14
|
+
<text v-else-if="n.name=='br'">\n</text>
|
|
15
|
+
<!--#endif-->
|
|
16
|
+
<!--视频-->
|
|
17
|
+
<view v-else-if="((n.lazyLoad&&!n.attrs.autoplay)||(n.name=='video'&&!loadVideo))&&ctrl[i]==undefined" :id="n.attrs.id"
|
|
18
|
+
:class="'_video '+(n.attrs.class||'')" :style="n.attrs.style" :data-i="i" @tap.stop="_loadVideo" />
|
|
19
|
+
<video v-else-if="n.name=='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||ctrl[i]==0"
|
|
20
|
+
:controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[ctrl[i]||0]"
|
|
21
|
+
:unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" :data-i="i" data-source="video" @error="error" @play="play" />
|
|
22
|
+
<!--音频-->
|
|
23
|
+
<audio v-else-if="n.name=='audio'" :ref="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author"
|
|
24
|
+
:autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster"
|
|
25
|
+
:src="n.attrs.source[ctrl[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio" @error.native="error"
|
|
26
|
+
@play.native="play" />
|
|
27
|
+
<!--链接-->
|
|
28
|
+
<view v-else-if="n.name=='a'" :id="n.attrs.id" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
|
|
29
|
+
:data-attrs="n.attrs" @tap.stop="linkpress">
|
|
30
|
+
<trees class="_span" c="_span" :nodes="n.children" />
|
|
31
|
+
</view>
|
|
32
|
+
<!--广告-->
|
|
33
|
+
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :unit-id="n.attrs['unit-id']" :appid="n.attrs.appid" :apid="n.attrs.apid" :type="n.attrs.type" :adpid="n.attrs.adpid" data-source="ad" @error="error" />-->
|
|
34
|
+
<!--列表-->
|
|
35
|
+
<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex;flex-direction:row'">
|
|
36
|
+
<view v-if="n.type=='ol'" class="_ol-bef">{{n.num}}</view>
|
|
37
|
+
<view v-else class="_ul-bef">
|
|
38
|
+
<view v-if="n.floor%3==0" class="_ul-p1">█</view>
|
|
39
|
+
<view v-else-if="n.floor%3==2" class="_ul-p2" />
|
|
40
|
+
<view v-else class="_ul-p1" style="border-radius:50%">█</view>
|
|
41
|
+
</view>
|
|
42
|
+
<trees class="_li" c="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
|
|
43
|
+
</view>
|
|
44
|
+
<!--表格-->
|
|
45
|
+
<view v-else-if="n.name=='table'&&n.c&&n.flag" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:grid'">
|
|
46
|
+
<trees v-for="(cell,n) in n.children" v-bind:key="n" :class="cell.attrs.class" :c="cell.attrs.class" :style="cell.attrs.style"
|
|
47
|
+
:s="cell.attrs.style" :nodes="cell.children" />
|
|
48
|
+
</view>
|
|
49
|
+
<view v-else-if="n.name=='table'&&n.c" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:table'">
|
|
50
|
+
<view v-for="(tbody, o) in n.children" v-bind:key="o" :class="tbody.attrs.class" :style="(tbody.attrs.style||'')+(tbody.name[0]=='t'?';display:table-'+(tbody.name=='tr'?'row':'row-group'):'')">
|
|
51
|
+
<view v-for="(tr, p) in tbody.children" v-bind:key="p" :class="tr.attrs.class" :style="(tr.attrs.style||'')+(tr.name[0]=='t'?';display:table-'+(tr.name=='tr'?'row':'cell'):'')">
|
|
52
|
+
<trees v-if="tr.name=='td'" :nodes="tr.children" />
|
|
53
|
+
<trees v-else v-for="(td, q) in tr.children" v-bind:key="q" :class="td.attrs.class" :c="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
|
|
54
|
+
:s="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')" :nodes="td.children" />
|
|
55
|
+
</view>
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
<!--#ifdef APP-PLUS-->
|
|
59
|
+
<iframe v-else-if="n.name=='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder"
|
|
60
|
+
:width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
|
61
|
+
<embed v-else-if="n.name=='embed'" :style="n.attrs.style" :width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
|
62
|
+
<!--#endif-->
|
|
63
|
+
<!--富文本-->
|
|
64
|
+
<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS-->
|
|
65
|
+
<rich-text v-else-if="handler.use(n)" :id="n.attrs.id" :class="'_p __'+n.name" :nodes="[n]" />
|
|
66
|
+
<!--#endif-->
|
|
67
|
+
<!--#ifndef MP-WEIXIN || MP-QQ || APP-PLUS-->
|
|
68
|
+
<rich-text v-else-if="!n.c" :id="n.attrs.id" :nodes="[n]" style="display:inline" />
|
|
69
|
+
<!--#endif-->
|
|
70
|
+
<trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :c="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')"
|
|
71
|
+
:style="n.attrs.style" :s="n.attrs.style" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
|
|
72
|
+
</block>
|
|
73
|
+
</view>
|
|
74
|
+
</template>
|
|
75
|
+
<script module="handler" lang="wxs" src="./handler.wxs"></script>
|
|
76
|
+
<script>
|
|
77
|
+
global.Parser = {};
|
|
78
|
+
import trees from './trees'
|
|
79
|
+
const errorImg = require('../libs/config.js').errorImg;
|
|
80
|
+
export default {
|
|
81
|
+
components: {
|
|
82
|
+
trees
|
|
83
|
+
},
|
|
84
|
+
name: 'trees',
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
ctrl: [],
|
|
88
|
+
placeholder: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="225"/>',
|
|
89
|
+
errorImg,
|
|
90
|
+
loadVideo: typeof plus == 'undefined',
|
|
91
|
+
// #ifndef MP-ALIPAY
|
|
92
|
+
c: '',
|
|
93
|
+
s: ''
|
|
94
|
+
// #endif
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
props: {
|
|
98
|
+
nodes: Array,
|
|
99
|
+
lazyLoad: Boolean,
|
|
100
|
+
loading: String,
|
|
101
|
+
// #ifdef MP-ALIPAY
|
|
102
|
+
c: String,
|
|
103
|
+
s: String
|
|
104
|
+
// #endif
|
|
105
|
+
},
|
|
106
|
+
mounted() {
|
|
107
|
+
for (this.top = this.$parent; this.top.$options.name != 'parser'; this.top = this.top.$parent);
|
|
108
|
+
this.init();
|
|
109
|
+
},
|
|
110
|
+
// #ifdef APP-PLUS
|
|
111
|
+
beforeDestroy() {
|
|
112
|
+
this.observer && this.observer.disconnect();
|
|
113
|
+
},
|
|
114
|
+
// #endif
|
|
115
|
+
methods: {
|
|
116
|
+
init() {
|
|
117
|
+
for (var i = this.nodes.length, n; n = this.nodes[--i];) {
|
|
118
|
+
if (n.name == 'img') {
|
|
119
|
+
this.top.imgList.setItem(n.attrs.i, n.attrs['original-src'] || n.attrs.src);
|
|
120
|
+
// #ifdef APP-PLUS
|
|
121
|
+
if (this.lazyLoad && !this.observer) {
|
|
122
|
+
this.observer = uni.createIntersectionObserver(this).relativeToViewport({
|
|
123
|
+
top: 500,
|
|
124
|
+
bottom: 500
|
|
125
|
+
});
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
this.observer.observe('._img', res => {
|
|
128
|
+
if (res.intersectionRatio) {
|
|
129
|
+
for (var j = this.nodes.length; j--;)
|
|
130
|
+
if (this.nodes[j].name == 'img')
|
|
131
|
+
this.$set(this.ctrl, j, 1);
|
|
132
|
+
this.observer.disconnect();
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
}, 0)
|
|
136
|
+
}
|
|
137
|
+
// #endif
|
|
138
|
+
} else if (n.name == 'video' || n.name == 'audio') {
|
|
139
|
+
var ctx;
|
|
140
|
+
if (n.name == 'video') {
|
|
141
|
+
ctx = uni.createVideoContext(n.attrs.id
|
|
142
|
+
// #ifndef MP-BAIDU
|
|
143
|
+
, this
|
|
144
|
+
// #endif
|
|
145
|
+
);
|
|
146
|
+
} else if (this.$refs[n.attrs.id])
|
|
147
|
+
ctx = this.$refs[n.attrs.id][0];
|
|
148
|
+
if (ctx) {
|
|
149
|
+
ctx.id = n.attrs.id;
|
|
150
|
+
this.top.videoContexts.push(ctx);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// #ifdef APP-PLUS
|
|
155
|
+
// APP 上避免 video 错位需要延时渲染
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
this.loadVideo = true;
|
|
158
|
+
}, 1000)
|
|
159
|
+
// #endif
|
|
160
|
+
},
|
|
161
|
+
play(e) {
|
|
162
|
+
var contexts = this.top.videoContexts;
|
|
163
|
+
if (contexts.length > 1 && this.top.autopause)
|
|
164
|
+
for (var i = contexts.length; i--;)
|
|
165
|
+
if (contexts[i].id != e.currentTarget.dataset.id)
|
|
166
|
+
contexts[i].pause();
|
|
167
|
+
},
|
|
168
|
+
imgtap(e) {
|
|
169
|
+
var attrs = e.currentTarget.dataset.attrs;
|
|
170
|
+
if (!attrs.ignore) {
|
|
171
|
+
var preview = true,
|
|
172
|
+
data = {
|
|
173
|
+
id: e.target.id,
|
|
174
|
+
src: attrs.src,
|
|
175
|
+
ignore: () => preview = false
|
|
176
|
+
};
|
|
177
|
+
global.Parser.onImgtap && global.Parser.onImgtap(data);
|
|
178
|
+
this.top.$emit('imgtap', data);
|
|
179
|
+
if (preview) {
|
|
180
|
+
var urls = this.top.imgList,
|
|
181
|
+
current = urls[attrs.i] ? parseInt(attrs.i) : (urls = [attrs.src], 0);
|
|
182
|
+
uni.previewImage({
|
|
183
|
+
current,
|
|
184
|
+
urls
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
loadImg(e) {
|
|
190
|
+
var i = e.currentTarget.dataset.i;
|
|
191
|
+
if (this.lazyLoad && !this.ctrl[i]) {
|
|
192
|
+
// #ifdef QUICKAPP-WEBVIEW
|
|
193
|
+
this.$set(this.ctrl, i, 0);
|
|
194
|
+
this.$nextTick(function() {
|
|
195
|
+
// #endif
|
|
196
|
+
// #ifndef APP-PLUS
|
|
197
|
+
this.$set(this.ctrl, i, 1);
|
|
198
|
+
// #endif
|
|
199
|
+
// #ifdef QUICKAPP-WEBVIEW
|
|
200
|
+
})
|
|
201
|
+
// #endif
|
|
202
|
+
} else if (this.loading && this.ctrl[i] != 2) {
|
|
203
|
+
// #ifdef QUICKAPP-WEBVIEW
|
|
204
|
+
this.$set(this.ctrl, i, 0);
|
|
205
|
+
this.$nextTick(function() {
|
|
206
|
+
// #endif
|
|
207
|
+
this.$set(this.ctrl, i, 2);
|
|
208
|
+
// #ifdef QUICKAPP-WEBVIEW
|
|
209
|
+
})
|
|
210
|
+
// #endif
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
linkpress(e) {
|
|
214
|
+
var jump = true,
|
|
215
|
+
attrs = e.currentTarget.dataset.attrs;
|
|
216
|
+
attrs.ignore = () => jump = false;
|
|
217
|
+
global.Parser.onLinkpress && global.Parser.onLinkpress(attrs);
|
|
218
|
+
this.top.$emit('linkpress', attrs);
|
|
219
|
+
if (jump) {
|
|
220
|
+
// #ifdef MP
|
|
221
|
+
if (attrs['app-id']) {
|
|
222
|
+
return uni.navigateToMiniProgram({
|
|
223
|
+
appId: attrs['app-id'],
|
|
224
|
+
path: attrs.path
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
// #endif
|
|
228
|
+
if (attrs.href) {
|
|
229
|
+
if (attrs.href[0] == '#') {
|
|
230
|
+
if (this.top.useAnchor)
|
|
231
|
+
this.top.navigateTo({
|
|
232
|
+
id: attrs.href.substring(1)
|
|
233
|
+
})
|
|
234
|
+
} else if (attrs.href.indexOf('http') == 0 || attrs.href.indexOf('//') == 0) {
|
|
235
|
+
// #ifdef APP-PLUS
|
|
236
|
+
plus.runtime.openWeb(attrs.href);
|
|
237
|
+
// #endif
|
|
238
|
+
// #ifndef APP-PLUS
|
|
239
|
+
uni.setClipboardData({
|
|
240
|
+
data: attrs.href,
|
|
241
|
+
success: () =>
|
|
242
|
+
uni.showToast({
|
|
243
|
+
title: '链接已复制'
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
// #endif
|
|
247
|
+
} else
|
|
248
|
+
uni.navigateTo({
|
|
249
|
+
url: attrs.href,
|
|
250
|
+
fail() {
|
|
251
|
+
uni.switchTab({
|
|
252
|
+
url: attrs.href,
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
error(e) {
|
|
260
|
+
var target = e.currentTarget,
|
|
261
|
+
source = target.dataset.source,
|
|
262
|
+
i = target.dataset.i;
|
|
263
|
+
if (source == 'video' || source == 'audio') {
|
|
264
|
+
// 加载其他 source
|
|
265
|
+
var index = this.ctrl[i] ? this.ctrl[i].i + 1 : 1;
|
|
266
|
+
if (index < this.nodes[i].attrs.source.length)
|
|
267
|
+
this.$set(this.ctrl, i, index);
|
|
268
|
+
if (e.detail.__args__)
|
|
269
|
+
e.detail = e.detail.__args__[0];
|
|
270
|
+
} else if (errorImg && source == 'img') {
|
|
271
|
+
this.top.imgList.setItem(target.dataset.index, errorImg);
|
|
272
|
+
this.$set(this.ctrl, i, 3);
|
|
273
|
+
}
|
|
274
|
+
this.top && this.top.$emit('error', {
|
|
275
|
+
source,
|
|
276
|
+
target,
|
|
277
|
+
errMsg: e.detail.errMsg
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
_loadVideo(e) {
|
|
281
|
+
this.$set(this.ctrl, e.target.dataset.i, 0);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<style>
|
|
288
|
+
/* 在这里引入自定义样式 */
|
|
289
|
+
|
|
290
|
+
/* 链接和图片效果 */
|
|
291
|
+
._a {
|
|
292
|
+
display: inline;
|
|
293
|
+
padding: 1.5px 0 1.5px 0;
|
|
294
|
+
color: #366092;
|
|
295
|
+
word-break: break-all;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
._hover {
|
|
299
|
+
text-decoration: underline;
|
|
300
|
+
opacity: 0.7;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
._img {
|
|
304
|
+
display: inline-block;
|
|
305
|
+
max-width: 100%;
|
|
306
|
+
overflow: hidden;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/* #ifdef MP-WEIXIN */
|
|
310
|
+
:host {
|
|
311
|
+
display: inline;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* #endif */
|
|
315
|
+
|
|
316
|
+
/* #ifndef MP-ALIPAY || APP-PLUS */
|
|
317
|
+
.interlayer {
|
|
318
|
+
display: inherit;
|
|
319
|
+
flex-direction: inherit;
|
|
320
|
+
flex-wrap: inherit;
|
|
321
|
+
align-content: inherit;
|
|
322
|
+
align-items: inherit;
|
|
323
|
+
justify-content: inherit;
|
|
324
|
+
width: 100%;
|
|
325
|
+
white-space: inherit;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* #endif */
|
|
329
|
+
|
|
330
|
+
._b,
|
|
331
|
+
._strong {
|
|
332
|
+
font-weight: bold;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* #ifndef MP-ALIPAY */
|
|
336
|
+
._blockquote,
|
|
337
|
+
._div,
|
|
338
|
+
._p,
|
|
339
|
+
._ol,
|
|
340
|
+
._ul,
|
|
341
|
+
._li {
|
|
342
|
+
display: block;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* #endif */
|
|
346
|
+
|
|
347
|
+
._code {
|
|
348
|
+
font-family: monospace;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
._del {
|
|
352
|
+
text-decoration: line-through;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
._em,
|
|
356
|
+
._i {
|
|
357
|
+
font-style: italic;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
._h1 {
|
|
361
|
+
font-size: 2em;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
._h2 {
|
|
365
|
+
font-size: 1.5em;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
._h3 {
|
|
369
|
+
font-size: 1.17em;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
._h5 {
|
|
373
|
+
font-size: 0.83em;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
._h6 {
|
|
377
|
+
font-size: 0.67em;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
._h1,
|
|
381
|
+
._h2,
|
|
382
|
+
._h3,
|
|
383
|
+
._h4,
|
|
384
|
+
._h5,
|
|
385
|
+
._h6 {
|
|
386
|
+
display: block;
|
|
387
|
+
font-weight: bold;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
._image {
|
|
391
|
+
display: block;
|
|
392
|
+
width: 100%;
|
|
393
|
+
height: 360px;
|
|
394
|
+
margin-top: -360px;
|
|
395
|
+
opacity: 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
._ins {
|
|
399
|
+
text-decoration: underline;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
._li {
|
|
403
|
+
flex: 1;
|
|
404
|
+
width: 0;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
._ol-bef {
|
|
408
|
+
width: 36px;
|
|
409
|
+
margin-right: 5px;
|
|
410
|
+
text-align: right;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
._ul-bef {
|
|
414
|
+
display: block;
|
|
415
|
+
margin: 0 12px 0 23px;
|
|
416
|
+
line-height: normal;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
._ol-bef,
|
|
420
|
+
._ul-bef {
|
|
421
|
+
flex: none;
|
|
422
|
+
user-select: none;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
._ul-p1 {
|
|
426
|
+
display: inline-block;
|
|
427
|
+
width: 0.3em;
|
|
428
|
+
height: 0.3em;
|
|
429
|
+
overflow: hidden;
|
|
430
|
+
line-height: 0.3em;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
._ul-p2 {
|
|
434
|
+
display: inline-block;
|
|
435
|
+
width: 0.23em;
|
|
436
|
+
height: 0.23em;
|
|
437
|
+
border: 0.05em solid black;
|
|
438
|
+
border-radius: 50%;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
._q::before {
|
|
442
|
+
content: '"';
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
._q::after {
|
|
446
|
+
content: '"';
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
._sub {
|
|
450
|
+
font-size: smaller;
|
|
451
|
+
vertical-align: sub;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
._sup {
|
|
455
|
+
font-size: smaller;
|
|
456
|
+
vertical-align: super;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* #ifdef MP-ALIPAY || APP-PLUS || QUICKAPP-WEBVIEW */
|
|
460
|
+
._abbr,
|
|
461
|
+
._b,
|
|
462
|
+
._code,
|
|
463
|
+
._del,
|
|
464
|
+
._em,
|
|
465
|
+
._i,
|
|
466
|
+
._ins,
|
|
467
|
+
._label,
|
|
468
|
+
._q,
|
|
469
|
+
._span,
|
|
470
|
+
._strong,
|
|
471
|
+
._sub,
|
|
472
|
+
._sup {
|
|
473
|
+
display: inline;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* #endif */
|
|
477
|
+
|
|
478
|
+
/* #ifdef MP-WEIXIN || MP-QQ */
|
|
479
|
+
.__bdo,
|
|
480
|
+
.__bdi,
|
|
481
|
+
.__ruby,
|
|
482
|
+
.__rt {
|
|
483
|
+
display: inline-block;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/* #endif */
|
|
487
|
+
._video {
|
|
488
|
+
position: relative;
|
|
489
|
+
display: inline-block;
|
|
490
|
+
width: 300px;
|
|
491
|
+
height: 225px;
|
|
492
|
+
background-color: black;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
._video::after {
|
|
496
|
+
position: absolute;
|
|
497
|
+
top: 50%;
|
|
498
|
+
left: 50%;
|
|
499
|
+
margin: -15px 0 0 -15px;
|
|
500
|
+
content: '';
|
|
501
|
+
border-color: transparent transparent transparent white;
|
|
502
|
+
border-style: solid;
|
|
503
|
+
border-width: 15px 0 15px 30px;
|
|
504
|
+
}
|
|
505
|
+
</style>
|