Commit 42586b7c by luyt

fix:表格内体字体调整判断14px

1 parent 0e4de1b3
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -81,19 +81,19 @@ export function getStrByWith(desc, width, fontsize) {
return temp
}
// scope.row[item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line"
// scope.row[item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line"
const lineEllipsis = (value, columnWidth, line = 1) => {
// console.log('value: ', value);
if (!value) return ''
// 假设一行的宽是字的个数10 160px的宽度 一个汉字16px
// 单元格左右的宽为16
// const strleng = Math.ceil((columnWidth-36)/16) * line - 2
const strleng = Math.ceil((columnWidth - 36) / 16) * line - 2
// const strleng = Math.ceil((columnWidth-36)/14) * line - 2
const strleng = Math.ceil((columnWidth - 36) / 14) * line - 2
if (value.length > strleng) {
// return value.substring(0, strleng) + '...'
// return handlerFn(value,columnWidth,line )
columnWidth = Math.floor(columnWidth * 0.5) - 30
columnWidth = Math.floor(columnWidth * 0.6) - 30
return getStrByWith(value, columnWidth, '14px')
}
}
......
......@@ -13,7 +13,7 @@
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
<template v-else-if="item.formatter">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="item.formatter(scope.row)">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="item.formatter(scope.row)">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ item.formatter(scope.row) | lineEllipsis(item.width, item.line) }}
</span>
......@@ -23,7 +23,7 @@
</span>
</template>
<template v-else-if="getListApi">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="scope.row[item.prop]">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="scope.row[item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ scope.row[item.prop] | lineEllipsis(item.width, item.line) }}
</span>
......@@ -35,7 +35,7 @@
<template v-else>
<!-- 大于10或 20个字节长度 宽度160px -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="tableData[scope.$index][item.prop]">
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="tableData[scope.$index][item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ tableData[scope.$index][item.prop] | lineEllipsis(item.width, item.line) }}
</span>
......@@ -472,6 +472,8 @@ export default {
padding-bottom: 4px;
.noDataImg {
margin-bottom: 12px;
width: 64px;
height: 40px;
}
}
......
......@@ -4,7 +4,7 @@
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
<template v-else-if="item.formatter">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="item.formatter(scope.row)">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="item.formatter(scope.row)">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ item.formatter(scope.row) | lineEllipsis(item.width, item.line) }}
</span>
......@@ -13,7 +13,7 @@
</template>
<template v-else-if="getListApi">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="scope.row[item.prop]">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" popper-class="base-popper" trigger="hover" :content="scope.row[item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ scope.row[item.prop] | lineEllipsis(item.width, item.line) }}
</span>
......@@ -24,7 +24,7 @@
<template v-else>
<!-- 大于10或 20个字节长度 -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= Math.ceil((item.width - 36) / 16) * item.line" placement="top" width="200" trigger="hover" :content="tableData[scope.$index][item.prop]">
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= Math.ceil((item.width - 36) / 14) * item.line" placement="top" width="200" trigger="hover" :content="tableData[scope.$index][item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ tableData[scope.$index][item.prop] | lineEllipsis(item.width, item.line) }}
</span>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!