veplayer-mp-douyin
Advanced tools
Comparing version 0.1.11-alpha.0 to 0.1.11
@@ -9,3 +9,3 @@ "use strict"; | ||
*/ | ||
const index_1 = require("../enums/index"); | ||
const enums_1 = require("../enums"); | ||
exports.default = Behavior({ | ||
@@ -24,7 +24,32 @@ properties: { | ||
}, | ||
data: { | ||
// video-player的style,video-player的宽高只能支持具体数值,不支持百分比。为了获取正确的大小,需要计算容器大小赋值给video-player | ||
playerStyle: '', | ||
}, | ||
lifetimes: { | ||
ready() { | ||
// TODO video-player有bug,css百分比宽高不能生效,只能通过style固定值设置,等后续bug修复后去掉该函数调用 | ||
this.setVideoPlayerStyle(); | ||
} | ||
}, | ||
methods: { | ||
onGetVideoInfo(e) { | ||
this._emitEvt(index_1.MediaEvents.GETVIDEOINFO, e); | ||
this._emitEvt(enums_1.MediaEvents.GETVIDEOINFO, e); | ||
}, | ||
setVideoPlayerStyle() { | ||
// 暂时无法监听组件的resize事件,需要业务方在容器大小发生变化时自己调用 | ||
if (this.properties.tagType === 'video-player') { | ||
let that = this; | ||
let query = tt.createSelectorQuery(); | ||
query.select('.xg-video-container').boundingClientRect(); | ||
query.exec(res => { | ||
const { height = 0, width = 0 } = res[0] || {}; | ||
const styleStr = `width: ${width}px; height: ${height}px`; | ||
that.setData({ | ||
playerStyle: styleStr | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
}); |
@@ -68,4 +68,2 @@ "use strict"; | ||
classNames: '', | ||
// video-player的style,video-player的宽高只能支持具体数值,不支持百分比 | ||
playerStyle: '', | ||
error: null, | ||
@@ -93,3 +91,3 @@ firstPlay: false, | ||
isFocus: true, | ||
// 可否使用其他type | ||
// 可否可使用video以外的其他tagType | ||
canUseOtherType: true, | ||
@@ -169,2 +167,3 @@ }, | ||
if (tagType !== 'video') { | ||
// 如果不能使用指定的tagType,则降级成video | ||
canUse = tt.canIUse(tagType); | ||
@@ -223,3 +222,2 @@ if (!canUse) { | ||
this.updateCollector(this.data); | ||
this.setPlayerStyle(); | ||
}, | ||
@@ -446,17 +444,3 @@ /** | ||
updateLoggerParams() { }, | ||
setPlayerStyle() { | ||
if (this.properties.tagType === 'video-player') { | ||
let that = this; | ||
let query = tt.createSelectorQuery(); | ||
query.select('.xg-video-container').boundingClientRect(); | ||
query.exec(res => { | ||
const { height = 0, width = 0 } = res[0] || {}; | ||
const styleStr = `width: ${width}px; height: ${height}px`; | ||
that.setData({ | ||
playerStyle: styleStr | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
}); |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "0.1.11-alpha.0", | ||
"version": "0.1.11", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "miniprogramType": "tt-npm", |
Sorry, the diff of this file is not supported yet
121083
1930