主管理员 2 weeks ago
parent
commit
6f92fff471
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      jeecgboot-vue3/src/views/applet/course-page/components/ContentEditor.vue

+ 9
- 3
jeecgboot-vue3/src/views/applet/course-page/components/ContentEditor.vue View File

@ -181,13 +181,14 @@ watch(
if (!c.style.fontFamily) c.style.fontFamily = 'SimSun';
if (!c.style.fontWeight) c.style.fontWeight = 'normal';
if (typeof c.isLead === 'undefined') c.isLead = false;
// px rpx rpx
// px rpx rpx rpx
if (typeof c.style.fontSize === 'string') {
if (/px$/i.test(c.style.fontSize)) {
c.style.fontSize = c.style.fontSize.replace(/px$/i, 'rpx');
} else if (/^\d+$/.test(c.style.fontSize)) {
c.style.fontSize = `${c.style.fontSize}rpx`;
}
// rpx
}
}
return c;
@ -278,8 +279,13 @@ function getFontSizeNumber(component: any) {
function setFontSizeNumber(component: any, value: number) {
ensureStyle(component);
// rpx
component.style.fontSize = `${value}rpx`;
// value rpx
const numValue = Number(value);
if (isNaN(numValue) || numValue <= 0) {
component.style.fontSize = '30rpx'; //
} else {
component.style.fontSize = `${numValue}rpx`;
}
emitUpdate();
}


Loading…
Cancel
Save