|
|
@ -67,13 +67,13 @@ export default { |
|
|
|
}); |
|
|
|
if (!data || !data.id) return; |
|
|
|
const reg = /data-root=["|']?(\w+)["|']?/gi; |
|
|
|
console.log(data.html); |
|
|
|
// console.log(data.html); |
|
|
|
if (data.html) { |
|
|
|
// 查有没有data-root=“xxx” 有的话 将xxx替换为 pluginTaskId |
|
|
|
|
|
|
|
if (reg.test(data.html)) { |
|
|
|
const uuid = RegExp.$1; |
|
|
|
console.log('uuid: ', uuid, `p${this.pluginTaskId}`); |
|
|
|
// console.log('uuid: ', uuid, `p${this.pluginTaskId}`); |
|
|
|
|
|
|
|
const str = data.html.replaceAll(uuid, `p${this.pluginTaskId}`); |
|
|
|
this.pluginContent = str; |
|
|
@ -81,7 +81,7 @@ export default { |
|
|
|
this.pluginContent = data.html; |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.pluginContent); |
|
|
|
// console.log(this.pluginContent); |
|
|
|
|
|
|
|
if (data.js) { |
|
|
|
if (reg.test(data.js)) { |
|
|
@ -102,6 +102,7 @@ export default { |
|
|
|
if (js && index === -1) { |
|
|
|
const scriptDom = document.createElement('script'); |
|
|
|
scriptDom.id = `p${pluginId}`; |
|
|
|
scriptDom.setAttribute('data-type', 'plugin'); |
|
|
|
scriptDom.innerHTML = js; |
|
|
|
this.$nextTick(() => { |
|
|
|
document.body.append(scriptDom); |
|
|
|