[add] Vue版本

This commit is contained in:
2022-04-05 18:40:31 +08:00
parent 12e3282760
commit 0fb4ba3740
9 changed files with 10263 additions and 127 deletions

View File

@@ -1,57 +1,45 @@
const PACKAGE_NAME = "uuidconvert";
const fs = require("fs");
Editor.Panel.extend({
style: `
:host { margin: 5px; }
h2 { color: #f90; }
.bottom {
height: 30px;
style: fs.readFileSync(Editor.url(`packages://${PACKAGE_NAME}/static/style/default/index.css`), 'utf-8')
.concat(fs.readFileSync(Editor.url(`packages://${PACKAGE_NAME}/static/style/default/bootstrap.min.css`), 'utf-8')),
template: fs.readFileSync(
Editor.url(`packages://${PACKAGE_NAME}/static/template/default/index.html`), 'utf-8'),
$: {
app: '#app',
},
ready() {
this.app = new Vue({
el: this.$app,
created: function () {
},
components: {
"counter": Editor.require(`packages://${PACKAGE_NAME}/static/template/vue/counter.js`)
},
data: function () {
return {}
},
methods: {
},
watch: {
}
})
},
methods: {
},
messages: {
}
`,
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!");
// }
// }
}
});