mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 01:27:47 +08:00
Initial commit
This commit is contained in:
39
js/components/window-control/index.js
Normal file
39
js/components/window-control/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Created by nuintun on 2015/11/19.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var ipc = require('ipc-renderer');
|
||||
var Vue = require('../../vue/vue');
|
||||
|
||||
module.exports = Vue.component('window-control', {
|
||||
data: function (){
|
||||
return {
|
||||
isMaximized: false
|
||||
}
|
||||
},
|
||||
template: fs.readFileSync(path.join(__dirname, 'window-control.html')).toString(),
|
||||
methods: {
|
||||
tray: function (){
|
||||
ipc.send('window', 'tray');
|
||||
},
|
||||
close: function (){
|
||||
ipc.send('window', 'close');
|
||||
},
|
||||
maximize: function (){
|
||||
ipc.send('window', this.isMaximized ? 'unmaximize' : 'maximize');
|
||||
}
|
||||
},
|
||||
created: function (){
|
||||
var context = this;
|
||||
|
||||
ipc.on('is-maximized', function (event, maximized){
|
||||
context.isMaximized = maximized;
|
||||
});
|
||||
|
||||
ipc.send('window', 'is-maximized');
|
||||
}
|
||||
});
|
11
js/components/window-control/window-control.html
Normal file
11
js/components/window-control/window-control.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="ui-window-control fn-right">
|
||||
<a @click="tray" title="缩小到托盘区" href="javascript:;">
|
||||
<i class="icon-minimize-tray"></i>
|
||||
</a>
|
||||
<a @click="maximize" :title="isMaximized?'还原':'最大化'" href="javascript:;">
|
||||
<i :class="{ 'icon-maximize' : !isMaximized, 'icon-unmaximize' : isMaximized }"></i>
|
||||
</a>
|
||||
<a @click="close" title="关闭" href="javascript:;">
|
||||
<i class="icon-cross"></i>
|
||||
</a>
|
||||
</div>
|
Reference in New Issue
Block a user