update files

This commit is contained in:
Nuintun
2015-11-20 16:08:44 +08:00
parent 09c9b8268e
commit 5950b48276
8 changed files with 96 additions and 21 deletions

View File

@@ -16,23 +16,10 @@
<span></span>
</div>
<div class="ui-popup-content">
<form>
<div v-show="submitError" class="ui-submit-tips">{{ submitError }}</div>
<form @submit.prevent="addProject">
<ul>
<li>
<label>项目名称:</label>
<input type="text" placeholder="项目名称"/>
</li>
<li class="ui-item-error">
<label class="fn-invisible">项目名称:</label>
<span><i class="icon-expand"></i>asdasdasdsa</span>
</li>
<li id="popup-open-dir">
<directory label="项目路径"></directory>
</li>
<li class="ui-item-error">
<label class="fn-invisible">项目名称:</label>
<span><i class="icon-expand"></i>asdasdasdsa</span>
</li>
<li is="project-base" :name.sync="name" :path.sync="path"></li>
<li class="ui-popup-control">
<input type="submit" class="ui-button" value="确定"/>
<input @click="popupToggle" type="button" class="ui-button ui-button-orange" value="取消"/>

View File

@@ -20,6 +20,10 @@ module.exports = Vue.component('app-configure', {
},
data: function (){
return {
name: '',
path: '',
_cached: {},
submitError: '',
popup: false
}
},
@@ -29,9 +33,34 @@ module.exports = Vue.component('app-configure', {
},
popupToggle: function (){
this.popup = !this.popup;
if (!this.popup) {
this.submitError = '';
this.$broadcast('clean-error');
}
},
addProject: function (){
this.$broadcast('submit');
if (this.name && this.path) {
if (this.$data._cached[this.name]) {
this.submitError = '项目已存在';
} else {
this.popup = false;
this.configure.projects.push({ name: this.name, path: this.path });
this.$data._cached[this.name] = true;
// clean imput
this.name = '';
this.path = '';
this.submitError = '';
}
}
}
},
created: function (){
this.configure.projects.forEach(function (project){
this.$data._cached[project.name] = true;
}, this);
}
});