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