From 08349b68e8f4f678af9e4fb88be7be7c64c5cc4c Mon Sep 17 00:00:00 2001 From: Chad Derya Date: Mon, 9 Sep 2019 19:28:40 +0100 Subject: [PATCH] Confirm delete button becomes enabled if item name matches the input text --- src/views/products/components/EditorImage.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/views/products/components/EditorImage.vue b/src/views/products/components/EditorImage.vue index 3b1d618c..9d46ff82 100644 --- a/src/views/products/components/EditorImage.vue +++ b/src/views/products/components/EditorImage.vue @@ -27,6 +27,7 @@

SUCCESS you can now close this popup

+

{{ item._id }}

ERROR please try again, if the error persist contact Chadmin!

@@ -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) {