PPTist/src/views/components/element/hooks/useElementShadow.ts
2021-02-11 14:13:49 +08:00

17 lines
401 B
TypeScript

import { computed, Ref } from 'vue'
import { PPTElementShadow } from '@/types/slides'
// 计算元素的阴影样式
export default (shadow: Ref<PPTElementShadow | undefined>) => {
const shadowStyle = computed(() => {
if (shadow.value) {
const { h, v, blur, color } = shadow.value
return `${h}px ${v}px ${blur}px ${color}`
}
return ''
})
return {
shadowStyle,
}
}