GridStack Vue Library - v13.0.0
    Preparing search index...

    Function useWidgetSerializer

    • Optional composable for widget components that need to participate in grid.save() / grid.load().

      Call this inside the setup() of a widget component rendered inside <GridStackItem>. The serialize function is called during grid.save() and its return value is merged into the widget's props in the serialized JSON. The deserialize function is called when GS updates the node (e.g. after grid.load()).

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      Returns void

      const count = ref(0)
      useWidgetSerializer({
      serialize: () => ({ count: count.value }),
      deserialize: (data) => { count.value = data.count as number ?? 0 },
      })