uuidconvert/panel/index.js
2022-03-31 08:57:26 +08:00

57 lines
1.3 KiB
JavaScript

Editor.Panel.extend({
style: `
:host { margin: 5px; }
h2 { color: #f90; }
.bottom {
height: 30px;
}
`,
template: `
<h2 style="text-align:center">Uuid Convert</h2>
<hr />
<div>
1. 填入要轉換的UUID<br>
</div>
<hr />
<div>
要轉換的UUID
<ui-input placeholder="UUID" id="uuid"></ui-input>
</div>
<hr />
<div style="text-align:right">
<ui-button id="run" class="blue">執行</ui-button>
</div>
`,
$: {
/** uuid */
uuid: "#uuid",
/** 生成按鈕 */
run: "#run",
},
ready() {
// Editor.Ipc.sendToMain("uuidconvert:panel-load-finish");
this.onClickRun();
},
/** 保存按鈕點擊事件 */
onClickRun() {
this.$run.addEventListener("confirm", () => {
if (!this.$uuid._value) {
Editor.error("請輸入要轉換的UUID");
return;
}
Editor.Ipc.sendToMain("uuidconvert:run-click", this.$uuid._value);
});
},
messages: {
// "setDefault": function (event, ...agrs) {
// if (event.reply) {
// //if no error, the first argument should be null
// event.reply(null, "Fine, thank you!");
// }
// }
}
});