Commit 80f0150d by 李伟康

fix(CustomerOpportunities): 修复表格标签显示问题

- 将 $nextTick 替换为 setTimeout 以解决异步渲染问题
- 添加 hasMoreTags 检查避免重复标签处理
- 移除不必要的 console.log 调试信息
- 简化标签截取逻辑提高性能
1 parent d9a0d920
...@@ -88,14 +88,14 @@ export default { ...@@ -88,14 +88,14 @@ export default {
handler(val) { handler(val) {
let query = uni.createSelectorQuery().in(this) let query = uni.createSelectorQuery().in(this)
this.tableData = val this.tableData = val
this.$nextTick(() => {
setTimeout(() => {
val.forEach((item, index) => { val.forEach((item, index) => {
query.select(`#tag-list-${index}`).boundingClientRect((data) => { query.select(`#tag-list-${index}`).boundingClientRect((data) => {
this.showTagMore(item.tagList, index, data) this.showTagMore(item.tagList, index, data)
}).exec() }).exec()
})
}) })
}, 100)
}, },
// immediate: true, // immediate: true,
deep: true deep: true
...@@ -142,6 +142,7 @@ export default { ...@@ -142,6 +142,7 @@ export default {
let query = uni.createSelectorQuery().in(this), let query = uni.createSelectorQuery().in(this),
_this = this, _this = this,
targetIndex = 0 targetIndex = 0
if (this.tableData[index] && this.tableData[index].hasMoreTags) return
this.$nextTick(() => { this.$nextTick(() => {
try { try {
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
...@@ -155,9 +156,7 @@ export default { ...@@ -155,9 +156,7 @@ export default {
}) })
}) })
promise.then(cutIndex => { promise.then(cutIndex => {
console.log(cutIndex) query.select(`#tag-${index}-${cutIndex}`).boundingClientRect((data) => {
this.$nextTick(() => {
if (cutIndex != 0) query.select(`#tag-${index}-${cutIndex}`).boundingClientRect((data) => {
let listWidth = listItem.left + listItem.width, let listWidth = listItem.left + listItem.width,
cutWidth = data.left + data.width cutWidth = data.left + data.width
if (cutWidth + 34 < listWidth) cutIndex += 1 if (cutWidth + 34 < listWidth) cutIndex += 1
...@@ -165,7 +164,6 @@ export default { ...@@ -165,7 +164,6 @@ export default {
_this.$set(_this.tableData[index], 'hasMoreTags', true) _this.$set(_this.tableData[index], 'hasMoreTags', true)
}).exec() }).exec()
}) })
})
} catch (error) { } catch (error) {
console.log(error) console.log(error)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!