update files

This commit is contained in:
nuintun
2015-11-23 10:18:34 +08:00
parent aeff3080ba
commit f29bfb70ac
5 changed files with 104 additions and 18 deletions

View File

@@ -16,6 +16,11 @@ module.exports = Vue.component('app-configure', {
type: Object,
twoWay: true,
required: true
},
uniqueProjects: {
type: Object,
twoWay: true,
required: true
}
},
data: function (){
@@ -26,17 +31,6 @@ module.exports = Vue.component('app-configure', {
popup: false
}
},
computed: {
uniqueCache: function (){
var cache = {};
this.configure.projects.forEach(function (project){
cache[project.name] = true;
});
return cache;
}
},
methods: {
focus: function (event){
if (event.target.type === 'text') {
@@ -59,10 +53,8 @@ module.exports = Vue.component('app-configure', {
addProject: function (){
this.$broadcast('submit');
console.log(this.uniqueCache[this.name]);
if (this.name && this.path) {
if (this.uniqueCache[this.name]) {
if (this.uniqueProjects[this.name]) {
this.submitError = '项目已存在';
} else {
this.popup = false;
@@ -73,6 +65,8 @@ module.exports = Vue.component('app-configure', {
this.path = '';
this.submitError = '';
// send message
this.$dispatch('change-active', this.configure.projects.length - 1);
this.$dispatch('save-configure');
}
}