xhlife / vue3-grid-layout

About A draggable and resizable grid layout, for Vue3.
https://github.com/xhlife/vue3-grid-layout
MIT License
101 stars 28 forks source link

[BUG] Prop col-num not applying in mount #21

Open jousepo opened 6 months ago

jousepo commented 6 months ago

Hi!!! i've a problem with the col-num/colNum prop that is not applying at the creation of the component but it works if i change after mount. I'm trying to set to 24 in mount but impossible.

xhlife commented 6 months ago

try async, beacuse there is a nextTick in the mounted function of grid layout

const colNum = ref(12)
onMounted(() => {
  nextTick(() => {
     colNum.value = 24
  })
  // or
  setTimeout(() => {

  })
})
jousepo commented 6 months ago

I've discovered that enabling is-draggable and is-resizable turns default col-num (12) again. Finally i did the next using a watcher because nextTick is not working alone:

colNum.value = 12 nextTick(() => { setTimeout(() => { colNum.value = customizedWidthSize }, 100) })

leoatfentech commented 5 months ago

Hey, I tried your trick @jousepo, but when I'm moving grid item, colsNum goes back to default, here is a quick video :

https://github.com/xhlife/vue3-grid-layout/assets/171169343/b51d1d74-b2f4-4148-aa39-5d394757102e

Any idea on how to solve this ?

jousepo commented 5 months ago

try with this props: :use-css-transforms="false" :responsive="true" breakpoints="{ lg: 768, md: 500, sm: 500, xs: 480, xxs: 0 }">