Files
myprojplanet_vite/src/components/CSelectAnimation/CSelectAnimation.ts

53 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-11-23 10:27:36 +01:00
import { defineComponent, onMounted, PropType, ref } from 'vue'
2022-11-20 10:21:02 +01:00
import { tools } from '@src/store/Modules/tools'
import { shared_consts } from '@src/common/shared_vuejs'
import { emit } from 'process'
2022-11-23 10:27:36 +01:00
import { IAnim } from '@src/model'
2022-11-20 10:21:02 +01:00
export default defineComponent({
name: 'CSelectAnimation',
emits: ['update:modelValue'],
props: {
modelValue: {
2022-11-23 10:27:36 +01:00
type: Object as PropType<IAnim | string | undefined>,
required: false,
default : () => {
return {name: '', clduration: '', cldelay: '', timingtype: 'ease-in-out'}
2022-11-23 10:27:36 +01:00
}
2022-11-20 10:21:02 +01:00
},
label: {
type: String,
required: false,
default: '',
},
},
setup(props, { emit }) {
const myclass = ref('')
2022-11-23 10:27:36 +01:00
const myrec = ref(<IAnim>{name: '', clduration: '', cldelay: ''})
2022-11-20 10:21:02 +01:00
function updateClass() {
2022-11-23 10:27:36 +01:00
if (typeof props.modelValue === 'object') {
myrec.value = props.modelValue
}
2022-11-20 10:21:02 +01:00
2022-11-23 10:27:36 +01:00
emit('update:modelValue', myrec.value)
2022-11-20 10:21:02 +01:00
}
function mounted() {
2022-11-23 10:27:36 +01:00
updateClass()
2022-11-20 10:21:02 +01:00
}
onMounted(mounted)
return {
tools,
updateClass,
2022-11-23 10:27:36 +01:00
myrec,
2022-11-20 10:21:02 +01:00
}
},
})