Files
myprojplanet_vite/src/components/CMyDialog/CMyDialog.ts
2025-12-05 17:56:05 +01:00

65 lines
1.2 KiB
TypeScript
Executable File

import { defineComponent, onMounted, ref, computed, watch } from 'vue'
import { tools } from '@store/Modules/tools'
import { useUserStore } from '@store/UserStore'
import { useI18n } from 'vue-i18n'
import { toolsext } from '@store/Modules/toolsext'
import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({
name: 'CMyDialog',
emits: ['update:modelValue'],
props: {
modelValue: {
type: Boolean,
required: true,
},
title: {
type: String,
required: false,
default: '',
},
class: {
type: String,
required: false,
default: '',
},
},
setup(props, { emit }) {
const userStore = useUserStore()
const { t } = useI18n();
const internalModel = ref(props.modelValue)
watch(
() => props.modelValue,
(newVal) => {
internalModel.value = newVal
}
)
watch(internalModel, (newVal) => {
emit('update:modelValue', newVal)
})
function mounted() {
// ...
}
onMounted(mounted)
return {
userStore,
costanti,
tools,
toolsext,
shared_consts,
t,
internalModel,
}
}
})