2015-11-23 15:23:34 +08:00

62 lines
1.2 KiB
JavaScript

/**
* Created by nuintun on 2015/11/20.
*/
var fs = require('fs');
var path = require('path');
var ipc = require('ipc-renderer');
var Vue = require('../../vue/vue');
require('../project-configure');
module.exports = Vue.component('app-main', {
template: fs.readFileSync(path.join(__dirname, 'app-main.html')).toString(),
props: {
activeIndex: {
type: Number,
required: true
},
projects: {
type: Array,
twoWay: true,
required: true
},
uniqueProjects: {
type: Object,
twoWay: true,
required: true
}
},
data: function (){
return {};
},
computed: {
project: function (){
var project = this.projects[this.activeIndex];
if (!project.env) {
project.env = [];
}
if (!project.command) {
project.command = [];
}
return JSON.parse(JSON.stringify(project));
}
},
methods: {
remove: function (){
this.projects.splice(this.activeIndex, 1);
this.$dispatch('save-configure');
}
},
events: {
edit: function (project){
this.projects.$set(this.activeIndex, project);
this.$dispatch('save-configure');
}
}
});