html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="./node_modules/@polymer/polymer/polymer.js"></script>
</head>
<body>
</body>
</html>
html
<dom-module id="custom-element">
<template>
<style>
</style>
<h1>Hello Polymer Java!</h1>
<button on-click="handleClick">Click me</button>
<div>{{message}}</div>
</template>
<script>
class CustomElement extends Polymer.Element {
static get is() { return 'custom-element'; }
static get properties() {
return {
message: {
type: String,
value: 'Welcome to Polymer Java!'
}
};
}
handleClick() {
this.message = 'Button clicked!';
}
}
customElements.define(CustomElement.is, CustomElement);
</script>
</dom-module>
html
<body>
<custom-element></custom-element>
</body>
shell
polymer build