mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-08 12:14:03 +08:00
update files
This commit is contained in:
parent
4608033522
commit
18027aa3ef
@ -18,7 +18,13 @@
|
||||
<div class="ui-popup-content">
|
||||
<form @submit.prevent="add">
|
||||
<ul>
|
||||
<li v-ref:base is="project-base" :name.sync="name" :path.sync="path" :unique="unique"></li>
|
||||
<li
|
||||
v-ref:base
|
||||
is="project-base"
|
||||
:origin-name.sync="name"
|
||||
:path.sync="path"
|
||||
:unique="unique">
|
||||
</li>
|
||||
<li class="ui-popup-control">
|
||||
<input type="submit" class="ui-button" value="确定"/>
|
||||
<input @click.stop="hidePopup" type="button" class="ui-button ui-button-orange" value="取消"/>
|
||||
|
@ -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 = '项目名称不能为空';
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -11,7 +11,7 @@
|
||||
<li
|
||||
v-ref:base
|
||||
is="project-base"
|
||||
:name.sync="clone.name"
|
||||
:origin-name.sync="clone.name"
|
||||
:path.sync="clone.path"
|
||||
:unique="unique">
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user