TUI

FloatBox 浮动框

可拖动的浮动容器,支持边界限制和自定义样式

限制边界
设置边界限制,防止拖出指定区域
边界限制
示例代码
vue
<template>
<div style="height: 300px; position: relative; border: 1px solid #eee; border-radius: 4px;">
  <FloatBox 
    :initialPosition="{ right: '20px', bottom: '20px' }"
    :boundaries="{ top: 10, right: 10, bottom: 10, left: 10 }"
  >
    <div style="width: 100px; height: 100px; background: #f0f9eb; 
                display: flex; align-items: center; justify-content: center; 
                border-radius: 4px;">
      边界限制
    </div>
  </FloatBox>
</div>
</template>

<script setup>
import { FloatBox } from '@packages';
</script>