diff --git a/src/miniprogram/index.js b/src/miniprogram/index.js index cf09896..3afe7de 100644 --- a/src/miniprogram/index.js +++ b/src/miniprogram/index.js @@ -78,11 +78,11 @@ Component({ /** * @description 是否允许图片被点击时自动预览 - * @type {Boolean} + * @type {Boolean | String} * @default true */ previewImg: { - type: Boolean, + type: null, value: true }, diff --git a/src/miniprogram/parser.js b/src/miniprogram/parser.js index 9bd5d38..ba2a999 100644 --- a/src/miniprogram/parser.js +++ b/src/miniprogram/parser.js @@ -421,7 +421,7 @@ Parser.prototype.onOpenTag = function (selfClose) { node.webp = 'T' } // data url 图片如果没有设置 original-src 默认为不可预览的小图片 - if (attrs.src.includes('data:') && !attrs['original-src']) { + if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) { attrs.ignore = 'T' } if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) { diff --git a/src/uni-app/components/mp-html/parser.js b/src/uni-app/components/mp-html/parser.js index 3e3f54b..fca436a 100644 --- a/src/uni-app/components/mp-html/parser.js +++ b/src/uni-app/components/mp-html/parser.js @@ -459,7 +459,7 @@ Parser.prototype.onOpenTag = function (selfClose) { node.webp = 'T' } // data url 图片如果没有设置 original-src 默认为不可预览的小图片 - if (attrs.src.includes('data:') && !attrs['original-src']) { + if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) { attrs.ignore = 'T' } if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {