tfp
Version:
A Web UI framework for TaskBuilder
41 lines (37 loc) • 1.5 kB
JavaScript
import TFPComponentRender from '../render.js'
export default class AudioCodeRender extends TFPComponentRender {
// 生成组件HTML
constructor(__tfp, _dataModel, _level) {
super(__tfp, _dataModel, _level);
}
getAttrHtml (retainStyleAttr) {
let attrHtml = super.getAttrHtml(retainStyleAttr);
attrHtml += " src=\"" + this.dataModel.src + "\"";
attrHtml += " width=\"" + this.dataModel.width + "px\"";
attrHtml += " height=\"" + this.dataModel.height + "px\"";
attrHtml += "style=\" object-fit:cover;\"";
if (this.dataModel.controls == true) {
attrHtml += " controls=\"" + this.dataModel.controls + "\"";
}
if (this.dataModel.loop == true) {
attrHtml += " loop=\"" + this.dataModel.loop + "\"";
}
if (this.dataModel.muted == true) {
attrHtml += " muted=\"" + this.dataModel.muted + "\"";
}
if (this.dataModel.autoplay == true) {
attrHtml += " autoplay=\"" + this.dataModel.autoplay + "\"";
}
if (this.dataModel.autoplay == true) {
attrHtml += " autoplay=\"" + this.dataModel.autoplay + "\"";
}
if (this.dataModel.poster) {
attrHtml += " poster=\"" + this.dataModel.poster + "\"";
}
return attrHtml;
}
getHtml (getComponentsHtml, parentIndent, retainStyleAttr) {
return super.getHtml("video", false, parentIndent, retainStyleAttr);
// 最外层节点 是否传给上层 父组件前面空格缩进 是否保留属性
}
}