Skip to content

Instantly share code, notes, and snippets.

@tuanna-hsp
Created September 30, 2021 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuanna-hsp/4056bbcf18f8ac9e1d0409557e034d6b to your computer and use it in GitHub Desktop.
Save tuanna-hsp/4056bbcf18f8ac9e1d0409557e034d6b to your computer and use it in GitHub Desktop.
<script lang="ts">
export default Vue.extend({
watch: {
saas: {
immediate: true,
handler(value): void {
if (value) {
// Clear current attr values
this.clearFormAttributes();
// Initialize form attributes for new service, note that we must use $set to preserve Vue reactiviy on `form` object
// (which is required for Vuelidate to work correctly)
this.allAttributes.forEach(attr => this.$set(this.form, attr, ""));
}
},
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment