update files

This commit is contained in:
nuintun
2015-11-24 12:41:58 +08:00
parent 4608033522
commit 18027aa3ef
4 changed files with 23 additions and 13 deletions

View File

@@ -13,7 +13,12 @@ require('../directory');
module.exports = Vue.component('project-base', {
template: fs.readFileSync(path.join(__dirname, 'project-base.html')).toString(),
props: {
name: {
originName: {
type: String,
twoWay: true,
default: ''
},
path: {
type: String,
twoWay: true,
default: ''
@@ -21,19 +26,20 @@ module.exports = Vue.component('project-base', {
unique: {
type: Object,
required: true
},
path: {
type: String,
twoWay: true,
default: ''
}
},
data: function (){
return {
name: this.originName,
nameError: '',
pathError: ''
};
},
watch: {
originName: function (name){
this.name = name;
}
},
methods: {
focus: function (key){
this[key] = '';
@@ -43,10 +49,11 @@ module.exports = Vue.component('project-base', {
this.path = this.path.trim();
if (this.name) {
if (this.unique[this.name]) {
if (this.originName && this.originName !== this.name && this.unique[this.name]) {
this.nameError = '项目已存在';
} else {
this.nameError = '';
this.originName = this.name;
}
} else {
this.nameError = '项目名称不能为空';