mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 01:27:47 +08:00
update files
This commit is contained in:
3
static/js/components/directory/directory.html
Normal file
3
static/js/components/directory/directory.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<label>{{label}}:</label>
|
||||
<input type="text" :title="path" :placeholder="label" v-model="path" lazy/>
|
||||
<a title="选择项目" href="javascript:;" class="icon-ellipsis" @click="open"></a>
|
39
static/js/components/directory/index.js
Normal file
39
static/js/components/directory/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Created by nuintun on 2015/11/17.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var ipc = require('ipc-renderer');
|
||||
var Vue = require('../../vue/vue');
|
||||
|
||||
module.exports = Vue.component('directory', {
|
||||
// camelCase in JavaScript
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
template: fs.readFileSync(path.join(__dirname, 'directory.html')).toString(),
|
||||
methods: {
|
||||
open: function (){
|
||||
ipc.send('open-directory', this.path, this._uid);
|
||||
}
|
||||
},
|
||||
created: function (){
|
||||
var context = this;
|
||||
|
||||
ipc.on('select-directory', function (event, paths, uid){
|
||||
if (context._uid === uid) {
|
||||
context.path = paths[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user