Initial commit
This commit is contained in:
commit
63ee71a19b
123 files changed
+11268
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
initRouter,
|
||||
Route,
|
||||
ViewChild,
|
||||
Component,
|
||||
ComponentInput,
|
||||
ComponentDefinition,
|
||||
} from "./pwa.js";
|
||||
|
||||
class TestComponent extends Component {
|
||||
static get definition() {
|
||||
return new ComponentDefinition({
|
||||
name: "test-component",
|
||||
template: `<div>
|
||||
<h1>Test Component</h1>
|
||||
<p>This is a test component.</p>
|
||||
<button
|
||||
id="test-button"
|
||||
(click)="incrementCount()"
|
||||
[class.green-button]="count % 2 !== 0"
|
||||
[class.red-button]="count % 2 === 0"
|
||||
>Count: {{count}}</button>
|
||||
</div>`,
|
||||
style: `
|
||||
.red-button {
|
||||
background-color: red;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.green-button {
|
||||
background-color: green;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`
|
||||
});
|
||||
}
|
||||
|
||||
count = new ComponentInput(0);
|
||||
|
||||
incrementCount() {
|
||||
this.count++;
|
||||
}
|
||||
}
|
||||
|
||||
const route1 = new Route("/counter", TestComponent);
|
||||
const route2 = new Route("/counter/:count", TestComponent);
|
||||
initRouter("routerOutlet", "styleOutlet", [route1, route2]);
|
||||
Reference in new issue
Block a user