flat: 暂存
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
<div>
|
||||
<el-tooltip v-if="content.length > length" class="item" effect="dark" placement="top-start">
|
||||
<div slot="content">
|
||||
<div v-for="(item, index) in clipStr(content)" :key="index"><div>{{item}}</div></div>
|
||||
<div v-for="(item, index) in clipStr(content)" :key="index">
|
||||
<div>{{ item }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<span>{{ content.length > length ? `${content.substring(0, this.length)}...` : content }}</span>
|
||||
</el-tooltip>
|
||||
@@ -27,9 +29,10 @@ export default {
|
||||
methods: {
|
||||
clipStr(str) {
|
||||
const clip = []
|
||||
if(str && str.length > this.tipWidth) {
|
||||
for (let i = 0; i < Math.ceil(str.length / this.tipWidth); i++) {
|
||||
clip.push(str.slice(i * this.tipWidth,i * this.tipWidth + this.tipWidth))
|
||||
const tipWidth = Number(this.tipWidth)
|
||||
if (str && str.length > tipWidth) {
|
||||
for (let i = 0; i < Math.ceil(str.length / tipWidth); i++) {
|
||||
clip.push(str.slice(i * tipWidth, (i * tipWidth) + tipWidth))
|
||||
}
|
||||
return clip
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user