Skip to content
On this page

静态元素

每一个元素可以通过设置static来使之成为静态元素,从而禁用自身的拖曳和缩放行为。同时不会被碰撞元素所影响。

vue
<template>
  <GridLayout
    v-model="layout"
  >
    <span
      key="a"
      class="grid-item"
    >a</span>
    <span
      key="b"
      class="grid-item"
    >static-b</span>
    <span
      key="c"
      class="grid-item"
    >c</span>
  </GridLayout>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { GridLayout } from 'free-dom'

const layout = ref([
  { i: 'a', x: 0, y: 0, w: 1, h: 2 },
  { i: 'b', x: 1, y: 0, w: 3, h: 2, static: true },
  { i: 'c', x: 4, y: 0, w: 1, h: 2 },
])
</script>