Confirm delete button becomes enabled if item name matches the input text

This commit is contained in:
Chad Derya 2019-09-09 19:28:40 +01:00
parent 51aeb7629f
commit 08349b68e8
1 changed files with 13 additions and 5 deletions

View File

@ -27,6 +27,7 @@
</div> </div>
<div v-else-if="viewState==='Success'"> <div v-else-if="viewState==='Success'">
<h1>SUCCESS you can now close this popup</h1> <h1>SUCCESS you can now close this popup</h1>
<h1>{{ item._id }}</h1>
</div> </div>
<div v-else-if="viewState==='Error'"> <div v-else-if="viewState==='Error'">
<h1>ERROR please try again, if the error persist contact Chadmin!</h1> <h1>ERROR please try again, if the error persist contact Chadmin!</h1>
@ -57,9 +58,18 @@ export default {
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
input: '', viewState: 'initialState',
isNameCorrect: false, isNameCorrect: true,
viewState: 'initialState' input: ''
}
},
watch: {
input: function() {
if (this.input === this.item.name) {
this.isNameCorrect = false
} else {
this.isNameCorrect = true
}
} }
}, },
methods: { methods: {
@ -71,8 +81,6 @@ export default {
return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess) return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
}, },
handleSubmit() { handleSubmit() {
console.log(this.input)
console.log(this.item._id)
if (this.input) { if (this.input) {
this.viewState = 'Success' this.viewState = 'Success'
} else if (!this.input) { } else if (!this.input) {