[mod] 非Vue
This commit is contained in:
parent
e7255001be
commit
c5f2494657
24
index.html
Normal file
24
index.html
Normal file
@ -0,0 +1,24 @@
|
||||
<div>
|
||||
<link href="style/default/bootstrap.min.css" rel="stylesheet">
|
||||
<h1 style="text-align:center">Uuid Convert</h1>
|
||||
<hr />
|
||||
<div>
|
||||
<h2 style="text-align:left">1. 填入要轉換的UUID</h2>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<h1 style="text-align:left">要轉換的UUID</h1>
|
||||
<div class="input-group input-group-lg">
|
||||
<input id="uuid" type="text" class="form-control" placeholder="UUID">
|
||||
</div>
|
||||
<br>
|
||||
<div class="input-group input-group-lg">
|
||||
<ui-asset id="asset" class="flex-1" type="native-asset" droppable="asset">
|
||||
</ui-asset>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div style="text-align:right">
|
||||
<ui-button id="run" class="blue btn btn-primary btn-lg btn-block">執行</ui-button>
|
||||
</div>
|
||||
</div>
|
12014
lib/vue.js
12014
lib/vue.js
File diff suppressed because it is too large
Load Diff
10
main.js
10
main.js
@ -44,17 +44,23 @@ module.exports = {
|
||||
try {
|
||||
let needconvertuuid = args[0];
|
||||
let uuid;
|
||||
let long_uuid;
|
||||
let short_uuid;
|
||||
if (needconvertuuid.indexOf("-") === -1) {
|
||||
// let convertuuid = this.decodeUuid(needconvertuuid);
|
||||
let convertuuid = EditorAPI.decompressUuid(needconvertuuid);
|
||||
Editor.log('convertuuid', convertuuid);
|
||||
uuid = convertuuid;
|
||||
short_uuid = needconvertuuid;
|
||||
long_uuid = convertuuid;
|
||||
} else {
|
||||
// let convertuuid = this.compressUuid(needconvertuuid);
|
||||
let convertuuid = EditorAPI.compressUuid(needconvertuuid);
|
||||
Editor.log('convertuuid', convertuuid);
|
||||
uuid = needconvertuuid;
|
||||
short_uuid = convertuuid;
|
||||
long_uuid = needconvertuuid;
|
||||
}
|
||||
Editor.log('short uuid', short_uuid);
|
||||
Editor.log('long uuid', long_uuid);
|
||||
Editor.Ipc.sendToAll('assets:hint', uuid);
|
||||
Editor.log('path: ', Editor.assetdb.uuidToUrl(uuid));
|
||||
} catch (error) {
|
||||
|
@ -5,7 +5,6 @@
|
||||
"author": "Sample",
|
||||
"main": "main.js",
|
||||
"scene-script": "scene-obtain.js",
|
||||
"engineSupport": true,
|
||||
"main-menu": {
|
||||
"扩展/Uuid Convert": {
|
||||
"message": "uuidconvert:open-panel"
|
||||
@ -15,6 +14,7 @@
|
||||
"main": "panel/index.js",
|
||||
"type": "dockable",
|
||||
"title": "Uuid Convert",
|
||||
"engineSupport": true,
|
||||
"width": 400,
|
||||
"height": 350
|
||||
}
|
||||
|
@ -1,44 +1,39 @@
|
||||
const PACKAGE_NAME = "uuidconvert";
|
||||
const fs = require("fs");
|
||||
const vue = Editor.require(`packages://${PACKAGE_NAME}/lib/vue.js`);
|
||||
|
||||
Editor.Panel.extend({
|
||||
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'),
|
||||
Editor.url(`packages://${PACKAGE_NAME}/index.html`), 'utf-8'),
|
||||
|
||||
$: {
|
||||
app: '#app',
|
||||
run: '#run',
|
||||
uuid: '#uuid',
|
||||
asset: '#asset',
|
||||
},
|
||||
|
||||
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: {
|
||||
|
||||
}
|
||||
})
|
||||
this.$run.addEventListener("confirm", this.methods.run.bind(this));
|
||||
},
|
||||
|
||||
methods: {
|
||||
run() {
|
||||
let uuid = "";
|
||||
// Editor.log(`$asset: ${this.$asset.value}`);
|
||||
if (!this.$uuid.value) {
|
||||
if (!this.$asset.value) {
|
||||
Editor.error("請輸入要轉換的UUID");
|
||||
return;
|
||||
} else {
|
||||
uuid = this.$asset.value;
|
||||
}
|
||||
} else {
|
||||
uuid = this.$uuid.value;
|
||||
}
|
||||
Editor.Ipc.sendToMain("uuidconvert:run-click", uuid);
|
||||
},
|
||||
},
|
||||
|
||||
messages: {
|
||||
|
@ -1,6 +0,0 @@
|
||||
<div>
|
||||
<link href="style/default/bootstrap.min.css" rel="stylesheet">
|
||||
<div id="app">
|
||||
<counter></counter>
|
||||
</div>
|
||||
</div>
|
@ -1,18 +0,0 @@
|
||||
<div class="counter">
|
||||
<h1 style="text-align:center">Uuid Convert</h1>
|
||||
<hr />
|
||||
<div>
|
||||
<h2 style="text-align:left">1. 填入要轉換的UUID</h2>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<h1 style="text-align:left">要轉換的UUID</h1>
|
||||
<div class="input-group input-group-lg">
|
||||
<input id="uuid" v-model="uuid" type="text" class="form-control" placeholder="UUID">
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div style="text-align:right">
|
||||
<button id="run" @click="run()" type="button" class="btn btn-primary btn-lg btn-block">執行</button>
|
||||
</div>
|
||||
</div>
|
@ -1,36 +0,0 @@
|
||||
const PACKAGE_NAME = "uuidconvert";
|
||||
const fs = require("fs");
|
||||
|
||||
module.exports = {
|
||||
name: "counter",
|
||||
|
||||
template: fs.readFileSync(Editor.url(`packages://${PACKAGE_NAME}/static/template/vue/counter.html`), 'utf-8'),
|
||||
|
||||
created: function () {
|
||||
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
uuid: ""
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
run() {
|
||||
if (!this.uuid) {
|
||||
Editor.error("請輸入要轉換的UUID");
|
||||
return;
|
||||
}
|
||||
Editor.Ipc.sendToMain("uuidconvert:run-click", this.uuid);
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user