UNPKG

eeeeeeuuuu-ui

Version:

uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水

12 lines (11 loc) 4.62 kB
require('../../../app.js'); (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uview-ui/components/u-parse/u-parse"],{5169:function(t,e,i){},"6e2f":function(t,e,i){"use strict";var s;i.r(e);var n,a=function(){var t=this,e=t.$createElement;t._self._c},o=[],r=i("fe20"),l=r["a"],h=(i("8cfa"),i("f0c5")),c=Object(h["a"])(l,a,o,!1,null,null,null,!1,s,n);e["default"]=c.exports},"8cfa":function(t,e,i){"use strict";var s=i("5169"),n=i.n(s);n.a},fe20:function(t,e,i){"use strict";(function(t){var s,n=function(){i.e("uview-ui/components/u-parse/libs/trees").then((()=>resolve(i("c087"))).bind(null,i)).catch(i.oe)},a={},o=t.getFileSystemManager?t.getFileSystemManager():null,r=i("e470");function l(t){for(var e=t.length,i=5381;e--;)i+=(i<<5)+t.charCodeAt(e);return i}e["a"]={name:"parser",data(){return{showAm:"",nodes:[]}},components:{trees:n},props:{html:String,autopause:{type:Boolean,default:!0},autoscroll:Boolean,autosetTitle:{type:Boolean,default:!0},compress:Number,loadingImg:String,useCache:Boolean,domain:String,lazyLoad:Boolean,selectable:Boolean,tagStyle:Object,showWithAnimation:Boolean,useAnchor:Boolean},watch:{html(t){this.setContent(t)}},created(){this.imgList=[],this.imgList.each=function(t){for(var e=0,i=this.length;e<i;e++)this.setItem(e,t(this[e],e,this))},this.imgList.setItem=function(t,e){if(void 0!=t&&e){if(0==e.indexOf("http")&&this.includes(e)){for(var i,s=e.split("://")[0],n=s.length;i=e[n];n++){if("/"==i&&"/"!=e[n-1]&&"/"!=e[n+1])break;s+=Math.random()>.5?i.toUpperCase():i}return s+=e.substr(n),this[t]=s}if(this[t]=e,e.includes("data:image")){var a,r=e.match(/data:image\/(\S+?);(\S+?),(.+)/);if(!r)return;a=`${wx.env.USER_DATA_PATH}/${Date.now()}.${r[1]}`,o&&o.writeFile({filePath:a,data:r[3],encoding:r[2],success:()=>this[t]=a})}}}},mounted(){s&&(this.document=new s(this)),this.html&&this.setContent(this.html)},beforeDestroy(){this.imgList.each(e=>{e&&e.includes(t.env.USER_DATA_PATH)&&o&&o.unlink({filePath:e})}),clearInterval(this._timer)},methods:{setContent(e,i){var s;if(!e)return this.nodes=[];var n,o=new r(e,this);if(this.useCache){var h=l(e);a[h]?s=a[h]:(s=o.parse(),a[h]=s)}else s=o.parse();this.$emit("parse",s),this.nodes=i?this.nodes.concat(s):s,s.length&&s.title&&this.autosetTitle&&t.setNavigationBarTitle({title:s.title}),this.imgList&&(this.imgList.length=0),this.videoContexts=[],this.$nextTick(()=>{(function t(e){for(var i=e.length;i--;)e[i].top&&(e[i].controls=[],e[i].init(),t(e[i].$children))})(this.$children),this.$emit("load")}),clearInterval(this._timer),this._timer=setInterval(()=>{t.createSelectorQuery().in(this).select("#_top").boundingClientRect().exec(t=>{t&&(this.rect=t[0],this.rect.height==n&&(this.$emit("ready",this.rect),clearInterval(this._timer)),n=this.rect.height)})},350),this.showWithAnimation&&!i&&(this.showAm="animation:_show .5s")},getText(t=this.nodes){for(var e,i="",s=0;e=t[s++];)if("text"==e.type)i+=e.text.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");else if("br"==e.type)i+="\n";else{var n="p"==e.name||"div"==e.name||"tr"==e.name||"li"==e.name||"h"==e.name[0]&&e.name[1]>"0"&&e.name[1]<"7";n&&i&&"\n"!=i[i.length-1]&&(i+="\n"),e.children&&(i+=this.getText(e.children)),n&&"\n"!=i[i.length-1]?i+="\n":"td"!=e.name&&"th"!=e.name||(i+="\t")}return i},in(t){t.page&&t.selector&&t.scrollTop&&(this._in=t)},navigateTo(e){if(!this.useAnchor)return e.fail&&e.fail("Anchor is disabled");var i=" ";i=">>>";var s=t.createSelectorQuery().in(this._in?this._in.page:this).select((this._in?this._in.selector:"#_top")+(e.id?`${i}#${e.id},${this._in?this._in.selector:"#_top"}${i}.${e.id}`:"")).boundingClientRect();this._in?s.select(this._in.selector).scrollOffset().select(this._in.selector).boundingClientRect():s.selectViewport().scrollOffset(),s.exec(i=>{if(!i[0])return e.fail&&e.fail("Label not found");var s=i[1].scrollTop+i[0].top-(i[2]?i[2].top:0)+(e.offset||0);this._in?this._in.page[this._in.scrollTop]=s:t.pageScrollTo({scrollTop:s,duration:300}),e.success&&e.success()})},getVideoContext(t){if(!t)return this.videoContexts;for(var e=this.videoContexts.length;e--;)if(this.videoContexts[e].id==t)return this.videoContexts[e]}}}}).call(this,i("543d")["default"])}}]); ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([ 'uview-ui/components/u-parse/u-parse-create-component', { 'uview-ui/components/u-parse/u-parse-create-component':(function(module, exports, __webpack_require__){ __webpack_require__('543d')['createComponent'](__webpack_require__("6e2f")) }) }, [['uview-ui/components/u-parse/u-parse-create-component']] ]);