Skip to content

Commit

Permalink
fix(swipe-cell): 修复t-swipe-cell 在 t-popup 中无法左右滑动 (#1141)
Browse files Browse the repository at this point in the history
在移动开始时,重新获取内容宽度,修复该问题

fix #1055
  • Loading branch information
yiqia authored Oct 26, 2023
1 parent c106e0c commit 4192acb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/swipe-cell/swipe-cell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default defineComponent({
if (props.disabled) {
return;
}
setPanelWidth();
swipeDir = 0;
initData.moved = false;
initData.offset = initData.pos;
Expand Down Expand Up @@ -231,12 +232,16 @@ export default defineComponent({
},
});
const classes = computed(() => [`${name}`]);
onMounted(() => {
const setPanelWidth = () => {
const leftWidth = leftRef.value?.clientWidth as number;
const rightWidth = rightRef.value?.clientWidth as number;
initData.leftWidth = leftWidth > 0 ? leftWidth : 0;
initData.rightWidth = rightWidth > 0 ? rightWidth : 0;
};
const classes = computed(() => [`${name}`]);
onMounted(async () => {
setPanelWidth();
renderMenuStatus();
});
onUnmounted(() => {
Expand Down

0 comments on commit 4192acb

Please sign in to comment.