update base class, add link to reference
This commit is contained in:
parent
51143163c8
commit
488cd8da5a
3 changed files with 10 additions and 2 deletions
|
@ -97,7 +97,7 @@ async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
|
||||||
!isBaseClassImported &&
|
!isBaseClassImported &&
|
||||||
content.toString().includes("extends WebComponent")
|
content.toString().includes("extends WebComponent")
|
||||||
) {
|
) {
|
||||||
const baseClassImport = `import { WebComponent } from "https://unpkg.com/web-component-base@1.7.1/WebComponent.mjs";`;
|
const baseClassImport = `import { WebComponent } from "https://unpkg.com/web-component-base@1.9.1/WebComponent.mjs";`;
|
||||||
|
|
||||||
registryScript += baseClassImport;
|
registryScript += baseClassImport;
|
||||||
isBaseClassImported = true;
|
isBaseClassImported = true;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* Custom element using a minimal Web Component Base class
|
||||||
|
* @see https://ayco.io/n/web-component-base
|
||||||
|
*/
|
||||||
class ClickableText extends WebComponent {
|
class ClickableText extends WebComponent {
|
||||||
onInit() {
|
onInit() {
|
||||||
this.onclick = () => alert("Thank you for clicking the text!");
|
this.onclick = () => alert("Thank you for clicking the text!");
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* Custom element using a minimal Web Component Base class
|
||||||
|
* @see https://ayco.io/n/web-component-base
|
||||||
|
*/
|
||||||
class HelloWorld extends WebComponent {
|
class HelloWorld extends WebComponent {
|
||||||
static properties = ["data-name"];
|
static properties = ["data-name"];
|
||||||
|
|
||||||
|
@ -10,6 +14,6 @@ class HelloWorld extends WebComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
get template() {
|
get template() {
|
||||||
return `<button style="cursor:pointer">Hello ${this["data-name"]}!</button>`;
|
return `<button style="cursor:pointer">Hello ${this.dataName}!</button>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue