|
|
@ -1,6 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="render-box shadow-lg" v-if="pluginInfo"> |
|
|
|
<view class="render-box shadow-lg"> |
|
|
|
<view |
|
|
|
class="render-content" |
|
|
|
:id="`render-${pluginTaskId}`" |
|
|
|
:data-did="task.detailId" |
|
|
|
:data-param="param" |
|
|
@ -16,6 +17,8 @@ |
|
|
|
:data-uid="userId" |
|
|
|
:pluginInfo="pluginInfo" |
|
|
|
:change:pluginInfo="project.renderDom" |
|
|
|
:pluginTaskId="pluginTaskId" |
|
|
|
:change:pluginTaskId="project.initPluginTaskId" |
|
|
|
></view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -82,19 +85,21 @@ export default { |
|
|
|
|
|
|
|
<script module="project" lang="renderjs"> |
|
|
|
// TODO: 未处理配置 多次使用插件的复用 |
|
|
|
let pluginTaskId = ''; |
|
|
|
|
|
|
|
export default { |
|
|
|
methods: { |
|
|
|
/** |
|
|
|
* 渲染dom |
|
|
|
* @param {object|null} res 插件详情 监听的pluginInfo |
|
|
|
* @param {*} b |
|
|
|
* @param {object} instance 实例对象 |
|
|
|
*/ |
|
|
|
renderDom(res, b, instance) { |
|
|
|
console.log('res,b,instance: ', res,b,instance); |
|
|
|
renderDom(res) { |
|
|
|
if (!res) return; |
|
|
|
this.$nextTick(() => { |
|
|
|
if (res.html) { |
|
|
|
const content = window.document.getElementById(`render-${this.pluginTaskId}`); |
|
|
|
// 注意: 截止目前版本2022年1月30日 直接this.pluginTaskId在APP端是不能行的 |
|
|
|
// 已向官方提交bug 后期等待修复后 再做调整 |
|
|
|
const content = window.document.getElementById(`render-${pluginTaskId}`); |
|
|
|
content.innerHTML = res.html; |
|
|
|
} |
|
|
|
|
|
|
@ -103,7 +108,17 @@ export default { |
|
|
|
script.innerHTML = res.js; |
|
|
|
window.document.body.appendChild(script); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 从prop data中拿到pluginTaskId, 存入变量中 |
|
|
|
* 因为目前这里没办法通过this拿到prop data下的数据 |
|
|
|
* @param {string} propsPluginTaskId |
|
|
|
*/ |
|
|
|
initPluginTaskId(propsPluginTaskId) { |
|
|
|
pluginTaskId = propsPluginTaskId; |
|
|
|
} |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|