From 18027aa3ef34906a4306200a152ca548be5b02fe Mon Sep 17 00:00:00 2001 From: nuintun Date: Tue, 24 Nov 2015 12:41:58 +0800 Subject: [PATCH] update files --- .../app-configure/app-configure.html | 8 ++++++- static/js/components/project-base/index.js | 21 ++++++++++++------- .../js/components/project-configure/index.js | 5 +---- .../project-configure/project-configure.html | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/static/js/components/app-configure/app-configure.html b/static/js/components/app-configure/app-configure.html index b5217a2..914d504 100644 --- a/static/js/components/app-configure/app-configure.html +++ b/static/js/components/app-configure/app-configure.html @@ -18,7 +18,13 @@
    -
  • +
  • +
  • diff --git a/static/js/components/project-base/index.js b/static/js/components/project-base/index.js index 05c6f82..73ba9b6 100644 --- a/static/js/components/project-base/index.js +++ b/static/js/components/project-base/index.js @@ -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 = '项目名称不能为空'; diff --git a/static/js/components/project-configure/index.js b/static/js/components/project-configure/index.js index 8e423ae..e74e466 100644 --- a/static/js/components/project-configure/index.js +++ b/static/js/components/project-configure/index.js @@ -31,7 +31,7 @@ module.exports = Vue.component('project-configure', { }, data: function (){ return { - clone: null + clone: util.clone(this.project) } }, watch: { @@ -71,8 +71,5 @@ module.exports = Vue.component('project-configure', { // clean this.reset(); } - }, - created: function (){ - this.clone = util.clone(this.project); } }); diff --git a/static/js/components/project-configure/project-configure.html b/static/js/components/project-configure/project-configure.html index 26b112d..0442867 100644 --- a/static/js/components/project-configure/project-configure.html +++ b/static/js/components/project-configure/project-configure.html @@ -11,7 +11,7 @@