<script setup lang="ts">
// 是否显示折叠按钮
const allowCollapse = ref<boolean>(true)

// 是否支持自由拉伸
const resizable = ref<boolean>(true)

// 是否上下布局模式
const vertical = ref<boolean>(false)

// 是否反转布局方向
const reverse = ref<boolean>(false)
</script>

<template>
  <el-card shadow="never">
    <el-form label-width="120px">
      <el-form-item label="显示折叠按钮">
        <el-radio-group v-model="allowCollapse">
          <el-radio label="是" :value="true"></el-radio>
          <el-radio label="否" :value="false"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="支持自由拉伸">
        <el-radio-group v-model="resizable">
          <el-radio label="是" :value="true"></el-radio>
          <el-radio label="否" :value="false"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="上下布局模式">
        <el-radio-group v-model="vertical">
          <el-radio label="是" :value="true"></el-radio>
          <el-radio label="否" :value="false"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="反转布局方向">
        <el-radio-group v-model="reverse">
          <el-radio label="是" :value="true"></el-radio>
          <el-radio label="否" :value="false"></el-radio>
        </el-radio-group>
      </el-form-item>
    </el-form>
    <el-split-panel
      space="0px"
      size="160px"
      :allow-collapse="allowCollapse"
      :resizable="resizable"
      :vertical="vertical"
      :reverse="reverse"
      :custom-style="{ background: '#E3E2F5', overflow: 'hidden', border: 'none' }"
      :body-style="{ background: '#CBF3FE', overflow: 'hidden' }"
      style="height: 360px"
    >
      <div>边栏</div>
      <template #body>
        <div>内容</div>
      </template>
    </el-split-panel>
  </el-card>
  <el-card shadow="never" class="mt-5">
    <div style="margin: 0 0 8px 0">先左右再上下</div>
    <el-split-panel
      space="0px"
      :min-size="40"
      :max-size="-40"
      :resizable="true"
      :custom-style="{
        background: 'rgba(185, 182, 229, .4)',
        overflow: 'hidden',
        border: 'none'
      }"
      :body-style="{ overflow: 'hidden' }"
      :responsive="false"
      style="height: 400px"
    >
      <div>边栏</div>
      <template #body>
        <el-split-panel
          space="0px"
          :min-size="40"
          :max-size="-40"
          :vertical="true"
          :resizable="true"
          :custom-style="{
            background: 'rgba(171, 199, 255, .5)',
            overflow: 'hidden',
            border: 'none'
          }"
          :body-style="{
            background: 'rgba(125, 226, 252, .4)',
            overflow: 'hidden'
          }"
          :responsive="false"
          style="height: 400px"
        >
          <div>内容一</div>
          <template #body>
            <div>内容二</div>
          </template>
        </el-split-panel>
      </template>
    </el-split-panel>
    <div style="margin: 16px 0 8px 0">先上下再左右</div>
    <el-split-panel
      space="0px"
      size="120px"
      :min-size="40"
      :max-size="-40"
      :vertical="true"
      :resizable="true"
      :custom-style="{
        background: 'rgba(185, 182, 229, .4)',
        overflow: 'hidden',
        border: 'none'
      }"
      :body-style="{ overflow: 'hidden' }"
      :responsive="false"
      style="height: 400px"
    >
      <div>顶栏</div>
      <template #body>
        <el-split-panel
          space="0px"
          :min-size="40"
          :max-size="-40"
          :resizable="true"
          :custom-style="{
            background: 'rgba(171, 199, 255, .5)',
            overflow: 'hidden',
            border: 'none'
          }"
          :body-style="{
            background: 'rgba(125, 226, 252, .4)',
            overflow: 'hidden'
          }"
          :responsive="false"
          style="height: 100%"
        >
          <div>边栏</div>
          <template #body>
            <div>内容</div>
          </template>
        </el-split-panel>
      </template>
    </el-split-panel>
  </el-card>
</template>

<style scoped></style>
