diff --git a/src/widget/lowcodeimage/lowcodeImage.vue b/src/widget/lowcodeimage/lowcodeImage.vue index dbc4f18..12174a9 100644 --- a/src/widget/lowcodeimage/lowcodeImage.vue +++ b/src/widget/lowcodeimage/lowcodeImage.vue @@ -29,10 +29,10 @@ const props = defineProps({ /* */ -let styleObject = { - -} - +let styleObject = reactive({ + width:"0", + height:"0" +}) const emits = defineEmits(["update:imgUrl","updateCont"]); @@ -66,8 +66,8 @@ switch (fitNum) { break; } -const showMode = props.data?.control.showMode - +const showMode = reactive(props.data?.control.showMode) +// console.log("图片像素样式-1-》",props.data?.control); if (showMode==='自定义像素值') { const pxWidth = props.data?.control.pxWidth const pxHeight = props.data?.control.pxHeight @@ -80,6 +80,24 @@ if (showMode==='自定义像素值') { styleObject.height = heightPercent+'%'; } +watch(()=>props.data?.control, (val) => { + + if (val.showMode==='自定义像素值') { + const pxWidth = props.data?.control.pxWidth + const pxHeight = props.data?.control.pxHeight + styleObject.width = pxWidth+'px'; + styleObject.height = pxHeight+'px'; + }else{ + const widthPercent = props.data?.control.widthPercent + const heightPercent = props.data?.control.heightPercent + styleObject.width = widthPercent+'%'; + styleObject.height = heightPercent+'%'; + } +},{ + deep: true, +}) + + const radius = props.data?.control.radius const radiusClass = ref(''); let radiusClassIsActive = false @@ -188,7 +206,7 @@ watch(() =>props.imgUrl,(val)=>{