Files
myprojplanet_vite/src/components/CImgPoster/CImgPoster.ts

108 lines
2.4 KiB
TypeScript
Raw Normal View History

2022-11-23 10:27:36 +01:00
import { defineComponent, PropType, ref } from 'vue'
2022-11-18 18:54:30 +01:00
import { tools } from '@src/store/Modules/tools'
import { shared_consts } from '@src/common/shared_vuejs'
2022-11-23 10:27:36 +01:00
import { IAnim } from '@src/model'
2022-11-18 18:54:30 +01:00
export default defineComponent({
name: 'CImgPoster',
props: {
src: {
type: String,
required: false,
default: '',
},
title: {
type: String,
required: false,
default: '',
},
myheight: {
type: String,
required: false,
default: '',
},
myheightmobile: {
type: Number,
required: false,
default: 0,
},
legendinside: {
type: String,
required: false,
default: '',
},
legend: {
type: String,
required: false,
default: '',
},
classTitle: String,
classSubtitle: String,
colorTitle: String,
colorSubtitle: String,
vertalign: Number,
speed: {
type: Number,
required: false,
default: 1
},
2022-11-23 10:27:36 +01:00
anim: {
type: Object as PropType<IAnim>,
2022-11-18 18:54:30 +01:00
required: false,
2022-11-23 10:27:36 +01:00
default: () => {
return { name: '', clduration: '', cldelay: '' }
},
2022-11-18 18:54:30 +01:00
},
2022-11-23 10:27:36 +01:00
anim2: {
type: Object as PropType<IAnim>,
2022-11-18 18:54:30 +01:00
required: false,
2022-11-23 10:27:36 +01:00
default: () => {
return { name: '', clduration: '', cldelay: '' }
},
2022-11-18 18:54:30 +01:00
},
logo: String,
logoheight: String,
logowidth: String,
fit: String,
},
setup(props) {
function getsrc(): string {
const filefull = tools.getimgFullpathbysize(props.src)
return tools.getimgbysize(filefull.path, filefull.file)
}
function getaltimg(): string {
const filefull = tools.getimgFullpathbysize(props.src)
return tools.getaltimg(filefull.path, filefull.file, props.title)
}
function myclass() {
let mycl = ''
if (props.vertalign === shared_consts.VERTALIGNTYPE.UP) {
mycl += ' align_top'
} else if (props.vertalign === shared_consts.VERTALIGNTYPE.CENTER) {
mycl += ' align_middle'
} else if (props.vertalign === shared_consts.VERTALIGNTYPE.DOWN) {
mycl += ' align_bottom'
} else if (props.vertalign === shared_consts.VERTALIGNTYPE.DOWN_LEFT) {
mycl += ' align_bottom_left'
} else if (props.vertalign === shared_consts.VERTALIGNTYPE.UP_LEFT) {
mycl += ' align_top_left'
}
return mycl
}
return {
getsrc,
getaltimg,
myclass,
tools,
}
},
})