Commit 45b15e27 authored by 张晨辰's avatar 张晨辰

feat: 增加文本行高和自动换行

parent a12ad020
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
margin: 0; margin: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
line-height: 1;
} }
} }
</style> </style>
......
...@@ -297,6 +297,16 @@ export const styles = { ...@@ -297,6 +297,16 @@ export const styles = {
// 如果是label类型,把fillColor转换为color // 如果是label类型,把fillColor转换为color
cmpSelfProps.color = cmpSelfProps.fillColor; cmpSelfProps.color = cmpSelfProps.fillColor;
delete cmpSelfProps.fillColor; delete cmpSelfProps.fillColor;
if (!onlyOpera) {
if (cmpSelfProps.lineType === 'single') {
// word-break: keep-all;white-space: nowrap;
cmpSelfProps.wordBreak = 'keep-all';
cmpSelfProps.whiteSpace = 'nowrap';
} else {
cmpSelfProps.wordBreak = 'break-all';
cmpSelfProps.whiteSpace = 'normal';
}
}
} }
// console.log('cmpSelfProps after inherit ', cmpSelfProps); // console.log('cmpSelfProps after inherit ', cmpSelfProps);
...@@ -314,10 +324,12 @@ export const styles = { ...@@ -314,10 +324,12 @@ export const styles = {
result += 'border-radius: 50%;' result += 'border-radius: 50%;'
} }
if (component.type === 'label' && !onlyOpera) { // if (component.type === 'label' && !onlyOpera) {
// 如果是label类型,禁止自动换行 // 如果是label类型,禁止自动换行
result += 'word-break: keep-all;white-space: nowrap;' // console.log('cmpSelfProps', cmpSelfProps);
}
// result += 'word-break: keep-all;white-space: nowrap;'
// }
// console.log('getComponentStyle',component.name, result); // console.log('getComponentStyle',component.name, result);
return result; return result;
......
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
groupName: '文本', groupName: '文本',
text: { text: {
title: '文本内容', title: '文本内容',
type: 'input', type: 'textArea',
value: '' value: ''
}, },
fillColor: { fillColor: {
...@@ -139,6 +139,15 @@ export default { ...@@ -139,6 +139,15 @@ export default {
type: 'colorPicker', type: 'colorPicker',
value: '#000' value: '#000'
}, },
lineType: {
title: '自动换行',
type: 'select',
options: [
{ label: '单行', value: 'single' },
{ label: '多行', value: 'multi' }
],
value: 'single'
},
size: { size: {
title: '字体大小', title: '字体大小',
type: 'swSelect', type: 'swSelect',
...@@ -147,6 +156,11 @@ export default { ...@@ -147,6 +156,11 @@ export default {
}, },
value: 12 value: 12
}, },
lineHeight: {
title: '行高',
type: 'inputNumber',
value: 1
},
textAlign: { textAlign: {
title: '文本对齐', title: '文本对齐',
type: 'select', type: 'select',
......
...@@ -95,6 +95,16 @@ const componentMapper = { ...@@ -95,6 +95,16 @@ const componentMapper = {
'controls-position': 'right' 'controls-position': 'right'
} }
}, },
textArea: {
component: 'el-input',
props: {
type: 'textarea',
autosize: {
minRows: 3,
maxRows: 10
}
}
},
input: { input: {
component: 'el-input' component: 'el-input'
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment