I have a page where users can edit their settings. I want to disable the submit button if the user has not made any changes to the form but for some reason the button is always enabled. Any ideas?
pages/settings/_id.vue
</template>
<b-button :disabled="userCopy == user">
Continue
</b-button>
</template>
<script>
import { mapState } from 'vuex'
import _ from 'lodash'
export default {
data() {
return {
userCopy: { offers: {}, legal: {} }
}
},
computed: {
...mapState({ user: (state) => state.users.user })
},
created() {
this.$store
.dispatch('users/fetchUser', this.$route.params.id)
.then((response) => {
this.userCopy = _.cloneDeep(response)
})
},
}
</script>