Commit ea68f968 by luyt

fix:hover光亮调整,fixed国产浏览器错位问题

1 parent 5d3c6e17
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
const lineEllipsis = (value,line = 1) => {
if (!value) return ''
// 假设一行的宽是字的个数10
const strleng = 10 * line - 2
if (value.length > strleng) {
return value.substring(0, strleng) + '...'
}
}
export default {
lineEllipsis
}
\ No newline at end of file
......@@ -32,6 +32,19 @@
import Vue from 'vue'
import App from './App.vue'
// 一次性注册所有的过滤器 本地测试
import filters from '@/filters'
// 一次性注册所有的自定义指令
// import directives from '@/directives'
// 注册全局过滤器(一次性注册)
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
// // 注册全局自定义指令(一次性注册)
// Object.keys(directives).forEach(key => {
// Vue.directive(key, directives[key])
// })
// element ui组件
import '@/plugins/element.js'
import '@/theme/theme.scss'
......
import GLTable from './src/index.vue'
// 一次性注册所有的过滤器 本地测试
import filters from '@/filters'
// 为组件提供 install 安装方法,供按需引入
GLTable.install = function(Vue) {
// 注册全局过滤器(一次性注册) 目前只用一个
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.component(GLTable.name, GLTable)
}
......
......@@ -5,33 +5,32 @@
<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 >= 10 * 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 : '' }" v-text="item.formatter(scope.row)"></span>
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ item.formatter(scope.row) | lineEllipsis(item.line) }}
</span>
</el-popover>
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<el-popover v-if="scope.row[item.prop] && scope.row[item.prop].length >= 10 * 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 : '' }" v-text="scope.row[item.prop]"></span>
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ scope.row[item.prop] | lineEllipsis(item.line) }}
</span>
</el-popover>
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="scope.row[item.prop]"></span>
</template>
<!-- <template v-else-if="item.labelchildren">
<el-table-column v-for="(labelitem, labelindex) in tableColumns.labelchildren" :key="'labelindex'+labelindex">
<span>123456</span>
</el-table-column> -->
<!-- <span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span> -->
<!-- </template> -->
<template v-else>
<!-- 大于10或 20个字节长度 -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= 10 * 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 : '' }" v-text="tableData[scope.$index][item.prop]"></span>
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
{{ tableData[scope.$index][item.prop] | lineEllipsis(item.line) }}
</span>
</el-popover>
<!-- <span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span> -->
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }">
<!-- {{tableData[scope.$index][item.prop] | }} todo 过滤器 -->
{{tableData[scope.$index][item.prop] }}
</span>
</template>
......
......@@ -41,15 +41,24 @@ import GLTable from './Table'
// test 组件
import TestComp from './TestComp'
// // 一次性注册所有的过滤器 本地测试
// import filters from '@/filters'
// 存储组件列表
const components = [GLExternal, GLButton, GLDialog, GLTable,TestComp]
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
const install = function(Vue) {
// // 注册全局过滤器(一次性注册)
// Object.keys(filters).forEach(key => {
// Vue.filter(key, filters[key])
// })
// 判断是否安装
if (install.installed) return
// 遍历注册全局组件
components.map(component => Vue.component(component.name, component))
}
// 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!