Skip to content

ResizeBox 伸缩框

代码演示

基础用法

vue
<template>
    <x-resize-box
        :directions="['right', 'bottom']"
        :height="200"
        :style="{ textAlign: 'center' }"
        :width="500">
        <a-typography-paragraph>We are building the future of content discovery and creation.</a-typography-paragraph>
        <a-divider />
        <a-typography-paragraph>
            ByteDance's content platforms enable people to enjoy content powered by AI technology. We inform, entertain,
            and inspire people across language, culture and geography.
        </a-typography-paragraph>
        <a-divider>ByteDance</a-divider>
        <a-typography-paragraph>Yiming Zhang is the founder and CEO of ByteDance.</a-typography-paragraph>
    </x-resize-box>
</template>

<script setup></script>

<style lang="less" scoped></style>

受控的高宽

vue
<template>
    <x-resize-box
        v-model:height="height"
        v-model:width="width"
        :directions="['right', 'bottom']"
        :style="{ textAlign: 'center' }">
        <a-typography-paragraph>We are building the future of content discovery and creation.</a-typography-paragraph>
        <a-divider />
        <a-typography-paragraph>
            ByteDance's content platforms enable people to enjoy content powered by AI technology. We inform, entertain,
            and inspire people across language, culture and geography.
        </a-typography-paragraph>
        <a-divider>ByteDance</a-divider>
        <a-typography-paragraph>Yiming Zhang is the founder and CEO of ByteDance.</a-typography-paragraph>
    </x-resize-box>

    <a-descriptions
        :column="1"
        class="mt-8-2">
        <a-descriptions-item label="width">{{ width }}</a-descriptions-item>
        <a-descriptions-item label="height">{{ height }}</a-descriptions-item>
    </a-descriptions>
</template>

<script setup>
import { ref } from 'vue'

const width = ref(500)
const height = ref(200)
</script>

<style lang="less" scoped></style>

API

Props

名称说明类型默认值
width(v-model)number-
height(v-model)number-
component容器标签stringdiv
min-width最小宽度number string100
min-height最小高度number string100
max-width最大宽度number string100%
max-height最大高度number string-
directions可以进行拖拽的边,可选:['left', 'right', 'top', 'bottom']array['right']
disabled禁用booleanfalse

Events

事件名说明返回值
movingStart拖拽开始event
moving拖拽中event
movingEnd拖拽结束event

本文档内容版权为 XYAdmin 作者所有,保留所有权利。