feat: widget
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
SCRIPT_SRC?: any,
|
||||
CONTAINER_ID?: any,
|
||||
options?: any,
|
||||
|
||||
inside?: boolean,
|
||||
widgetKey?: any
|
||||
}>()
|
||||
|
||||
@@ -45,10 +45,13 @@
|
||||
const script = document.createElement('script');
|
||||
script.id = props.SCRIPT_ID;
|
||||
script.type = 'text/javascript';
|
||||
// script.async = true;
|
||||
script.async = true;
|
||||
script.src = props.SCRIPT_SRC;
|
||||
script.onload = onload;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
if (props.inside) document.getElementById(props.CONTAINER_ID) && document.getElementById(props.CONTAINER_ID).appendChild(script);
|
||||
else {
|
||||
document.getElementsByTagName('body')[0].appendChild(script);
|
||||
}
|
||||
}
|
||||
const initWidget = (key: any) => {
|
||||
if (typeof widgets[key].key === 'undefined') {
|
||||
@@ -73,7 +76,5 @@
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ClientOnly>
|
||||
<div :key="props.CONTAINER_ID" :id="props.CONTAINER_ID"></div>
|
||||
</ClientOnly>
|
||||
<div :key="props.CONTAINER_ID" :id="props.CONTAINER_ID"></div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user