feat: remove usage of .sync and define explicitly emits (#10209)

References

- https://v3-migration.vuejs.org/breaking-changes/v-model
-
https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html
This commit is contained in:
Shivam Mishra
2024-10-03 12:44:18 +05:30
committed by GitHub
parent edc1fe2363
commit b8d0252511
82 changed files with 224 additions and 221 deletions

View File

@@ -1,4 +1,5 @@
<script>
import { defineModel } from 'vue';
import { required } from '@vuelidate/validators';
import { useVuelidate } from '@vuelidate/core';
import Modal from '../../Modal.vue';
@@ -8,37 +9,17 @@ export default {
Modal,
},
props: {
show: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '',
},
message: {
type: String,
default: '',
},
confirmText: {
type: String,
default: '',
},
rejectText: {
type: String,
default: '',
},
confirmValue: {
type: String,
default: '',
},
confirmPlaceHolderText: {
type: String,
default: '',
},
title: { type: String, default: '' },
message: { type: String, default: '' },
confirmText: { type: String, default: '' },
rejectText: { type: String, default: '' },
confirmValue: { type: String, default: '' },
confirmPlaceHolderText: { type: String, default: '' },
},
emits: ['onClose', 'onConfirm'],
setup() {
return { v$: useVuelidate() };
const show = defineModel('show', { type: Boolean, default: false });
return { v$: useVuelidate(), show };
},
data() {
return {
@@ -65,9 +46,8 @@ export default {
};
</script>
<!-- eslint-disable vue/no-mutating-props -->
<template>
<Modal :show.sync="show" :on-close="closeModal">
<Modal v-model:show="show" :on-close="closeModal">
<woot-modal-header :header-title="title" :header-content="message" />
<form @submit.prevent="onConfirm">
<woot-input

View File

@@ -51,7 +51,7 @@ export default {
</script>
<template>
<Modal :show.sync="show" :on-close="cancel">
<Modal v-model:show="show" :on-close="cancel">
<div class="h-auto overflow-auto flex flex-col">
<woot-modal-header :header-title="title" :header-content="description" />
<div class="flex flex-row justify-end gap-2 py-4 px-6 w-full">

View File

@@ -1,26 +1,21 @@
<script>
<script setup>
import Modal from '../../Modal.vue';
export default {
components: {
Modal,
},
props: {
show: Boolean,
onClose: { type: Function, default: () => {} },
onConfirm: { type: Function, default: () => {} },
title: { type: String, default: '' },
message: { type: String, default: '' },
messageValue: { type: String, default: '' },
confirmText: { type: String, default: '' },
rejectText: { type: String, default: '' },
},
};
defineProps({
onClose: { type: Function, default: () => {} },
onConfirm: { type: Function, default: () => {} },
title: { type: String, default: '' },
message: { type: String, default: '' },
messageValue: { type: String, default: '' },
confirmText: { type: String, default: '' },
rejectText: { type: String, default: '' },
});
const show = defineModel('show', { type: Boolean, default: false });
</script>
<!-- eslint-disable vue/no-mutating-props -->
<template>
<Modal :show.sync="show" :on-close="onClose">
<Modal v-model:show="show" :on-close="onClose">
<woot-modal-header
:header-title="title"
:header-content="message"