@pluginarch/create-parch
Version:
this is way to create a ui project
47 lines (43 loc) • 1.74 kB
JavaScript
const HTMLElement = globalThis.HTMLElement || class {};
// const customElements = globalThis.customElements || class {
// static define=(a,b)=>{}
// };
class CanvasEditor extends BaseElement {
constructor(opts) {
debugger
super(opts);
// this.opts = opts
this._initTemplate();
}
connectedCallback() {
console.log('AppElement is connected to the DOM');
}
_initTemplate() {
this.template = document.createElement('template');
this.template.innerHTML = `
<div style="margin: 10px ">
<pe-button id="pebutton1" label="按钮模板" onClicked="handleClick" style='width:60px;height:20px;color:#fff;'></pe-button>
</div>
<script>
console.log('canvasEditor:'+window.Vue);
</script>
`;
// const templateStr =
// `
// <div style="margin: 10px ">
// <pe-button id="pebutton1" label="按钮模板" onClicked="handleClick" style='width:100px;height:40px;color:#fff;'></pe-button>
// </div>
// <script type="text/javascript">
// debugger;
// </script>
// `
// this.template.innerHTML += cssStr + scriptStr
// this.shadow.appendChild(this.template.content.cloneNode(true));
const pbutton1 = new PEButton(this.opts)
// this.template.innerHTML += pbutton1
this.shadow.appendChild(pbutton1);
debugger
// this.parseTemplate(this.template.innerHTML,``);
}
}
customElements.define('pe-canvaseditor', CanvasEditor);