提交 805c4ebf 编写于 作者: D DCloud_LXH

fix(App): rich-text normlize path

上级 67ca9fea
......@@ -2,6 +2,7 @@ import {
hasOwn,
isPlainObject
} from 'uni-shared'
import getRealPath from 'uni-platform/helpers/get-real-path'
const TAGS = {
a: '',
......@@ -96,6 +97,11 @@ function decodeEntities (htmlString) {
})
}
function normlizeValue (tagName, name, value) {
if (tagName === 'img' && name === 'src') return getRealPath(value)
return value
}
export default function parseNodes (nodes, parentNode, $vm) {
let scopeId = ''
while ($vm) {
......@@ -134,7 +140,7 @@ export default function parseNodes (nodes, parentNode, $vm) {
break
default:
if (tagAttrs.indexOf(name) !== -1) {
elem.setAttribute(name, value)
elem.setAttribute(name, normlizeValue(tagName, name, value))
}
}
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册