fix: dynamic base class import
This commit is contained in:
parent
b3c37ebb25
commit
b25c0ef0dc
4 changed files with 4 additions and 4 deletions
|
@ -88,6 +88,7 @@ async function insertRegistry(
|
||||||
|
|
||||||
async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
|
async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
|
||||||
let registryScript = `<script type='module'>`;
|
let registryScript = `<script type='module'>`;
|
||||||
|
let baseClassImported = false;
|
||||||
|
|
||||||
for (const name of usedCustomElements) {
|
for (const name of usedCustomElements) {
|
||||||
const content = await useStorage().getItem(
|
const content = await useStorage().getItem(
|
||||||
|
@ -97,7 +98,6 @@ async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
|
||||||
`class WebComponent {}; class HTMLElement {}; (${content.toString()})`
|
`class WebComponent {}; class HTMLElement {}; (${content.toString()})`
|
||||||
);
|
);
|
||||||
const className = new evalStore().constructor.name;
|
const className = new evalStore().constructor.name;
|
||||||
let baseClassImported = false;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!baseClassImported &&
|
!baseClassImported &&
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<main>
|
<main>
|
||||||
<a href="/demo/about">{{ count }}</a>
|
<a href="/demo/about">{{ count }}</a>
|
||||||
<div>
|
<div>
|
||||||
<hello-world name="{{name }}"></hello-world>
|
<my-hello-world name="{{name }}"></my-hello-world>
|
||||||
</div>
|
</div>
|
||||||
<p>some text: {{greeting}}</p>
|
<p>some text: {{greeting}}</p>
|
||||||
{{greeting}} hey<br />
|
{{greeting}} hey<br />
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
</main>
|
</main>
|
||||||
<my-footer></my-footer>
|
<my-footer></my-footer>
|
||||||
<script>
|
<script>
|
||||||
const helloWorld = document.querySelector("hello-world");
|
const helloWorld = document.querySelector("my-hello-world");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
helloWorld.setAttribute("name", "Nitro");
|
helloWorld.setAttribute("name", "Nitro");
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Here's a sample interactive custom element:
|
Here's a sample interactive custom element:
|
||||||
<hello-world name="McFly"></hello-world>
|
<vanilla-hello-world name="McFly"></vanilla-hello-world>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Start at the very basic of writing HTML files and enhance with standard
|
Start at the very basic of writing HTML files and enhance with standard
|
||||||
|
|
Loading…
Reference in a new issue