|
|
|
@ -176,7 +176,7 @@ watch( |
|
|
|
componentsRef.value = cloned.map((c: any) => { |
|
|
|
if (c?.type === 'text') { |
|
|
|
if (!c.style) c.style = {}; |
|
|
|
if (!c.style.fontSize) c.style.fontSize = '30rpx'; |
|
|
|
if (!c.style.fontSize) c.style.fontSize = '40rpx'; |
|
|
|
if (!c.style.color) c.style.color = '#333333'; |
|
|
|
if (!c.style.fontFamily) c.style.fontFamily = 'SimSun'; |
|
|
|
if (!c.style.fontWeight) c.style.fontWeight = 'normal'; |
|
|
|
@ -208,7 +208,7 @@ function addTextContent() { |
|
|
|
content: '', |
|
|
|
language: 'zh', |
|
|
|
style: { |
|
|
|
fontSize: '30rpx', |
|
|
|
fontSize: '40rpx', |
|
|
|
color: '#333333', |
|
|
|
fontFamily: 'SimSun', |
|
|
|
}, |
|
|
|
@ -272,9 +272,9 @@ function ensureStyle(component: any) { |
|
|
|
|
|
|
|
function getFontSizeNumber(component: any) { |
|
|
|
const s = component.style?.fontSize; |
|
|
|
if (!s) return 30; |
|
|
|
if (!s) return 40; |
|
|
|
const m = typeof s === 'string' ? s.match(/(\d+)/) : null; |
|
|
|
return m ? Number(m[1]) : 30; |
|
|
|
return m ? Number(m[1]) : 40; |
|
|
|
} |
|
|
|
|
|
|
|
function setFontSizeNumber(component: any, value: number) { |
|
|
|
@ -282,7 +282,7 @@ function setFontSizeNumber(component: any, value: number) { |
|
|
|
// 确保value是有效数字,然后统一以 rpx 保存 |
|
|
|
const numValue = Number(value); |
|
|
|
if (isNaN(numValue) || numValue <= 0) { |
|
|
|
component.style.fontSize = '30rpx'; // 默认值 |
|
|
|
component.style.fontSize = '40rpx'; // 默认值 |
|
|
|
} else { |
|
|
|
component.style.fontSize = `${numValue}rpx`; |
|
|
|
} |
|
|
|
|