使用方法: 建议新建一个公用的mixin文件-全局挂载,然后随便使用:
import Config from '@/config/config.js'
import JSEncrypt from '@/common/jsencrypt/bin/jsencrypt.js'
export default {
data() {
return {
systemBarHeight: uni.getSystemInfoSync().statusBarHeight,
screenWidth: uni.getSystemInfoSync().windowWidth,
screenHeight: uni.getSystemInfoSync().windowHeight,
differTime: 0,
}
},
filters: {
//控制富文本中的图片大小
formatRichText(html) {
if (!html) return
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"