一、table组件固定页滚动条缩放时断裂问题
解决方式
监听窗口缩放事件,使用doLayout方法重绘,再加个防抖
代码示例
mounted() {
this.antiShake = this.shakeProof(this.dropDowwn, 500)
window.onresize = () => {
this.antiShake()
}
},
methods: {
shakeProof(antiShake, delay) {
let timer
return function(args) {
clearInterval(timer)
timer = setTimeout(() => {
this.$refs.orderList.doLayout()
}, delay)
}
},
}
二、table合计行自定义代码、tooltip 组件content使用slot引入到html结构中
合计行时table组件自动生成的,页面中时没有代码可以改的,不过开发可以在合计行赋值时使用方法将html引入到页面中。
代码示例
sums[index] = (() => {
const content = this.$capitalizationAmount(this.order_price)
const data = this.order_price
const el = <el-tooltip id='total-dark' class='item' effect='dark' placement='top-start'>
<span id='total-Summaries'>¥{data}</span>
<div slot='content' id='total-slot'>
{content}
</div>
</el-tooltip>
return el
})()
return
三、 Upload 文件缩略图类型不支持删除
element中上传组件中有个文件缩略图的类型,和其他类型不一样,其他的可以直接删除,这个需要自己手动删除,那么这就有个问题file-list这个是不支持双向绑定的,也就是说,想要直接在这里面去掉删除项是不行的。但是可以从uploadFiles中获得上传图片。
代码示例
handleRemove(file) {
const fileList = this.$refs.upload.uploadFiles
const index = fileList.findIndex(fileItem => {
return fileItem.uid === file.uid
})
fileList.splice(index, 1)
this.params.media.splice(index, 1)
},