Skip to content

Commit

Permalink
修复了 video 标签高度设置为 auto 不显示的问题 #411
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-yufeng committed Mar 11, 2022
1 parent 346631c commit c7c9d33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/miniprogram/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,9 @@ Parser.prototype.popNode = function () {
} else if (node.name === 'a' || node.name === 'ad') {
this.expose()
} else if (node.name === 'video' || node.name === 'audio') {
if ((styleObj.height || '').includes('auto')) {
styleObj.height = undefined
}
node.children = undefined
} else if ((node.name === 'ul' || node.name === 'ol') && node.c) {
// 列表处理
Expand Down
9 changes: 7 additions & 2 deletions src/uni-app/components/mp-html/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,11 @@ Parser.prototype.popNode = function () {
// #endif
) {
this.expose()
} /* #ifdef APP-PLUS */ else if (node.name === 'video') {
} else if (node.name === 'video') {
if ((styleObj.height || '').includes('auto')) {
styleObj.height = undefined
}
/* #ifdef APP-PLUS */
let str = '<video style="width:100%;height:100%"'
for (const item in attrs) {
if (attrs[item]) {
Expand All @@ -745,7 +749,8 @@ Parser.prototype.popNode = function () {
}
str += '</video>'
node.html = str
} /* #endif */ else if ((node.name === 'ul' || node.name === 'ol') && node.c) {
/* #endif */
} else if ((node.name === 'ul' || node.name === 'ol') && node.c) {
// 列表处理
const types = {
a: 'lower-alpha',
Expand Down

0 comments on commit c7c9d33

Please sign in to comment.