<template>
  <CusDialog
      title="标题"
      :show="show"
      @close="$emit('update:show', false)"
      @submit="$emit('update:show', false)"
      :footAlign="footAlign"
      :showClose="showClose"
      :showSubmit="showSubmit"
  >
    <template #head>
      <div class="head-slot">这是顶部的插槽(head)</div>
    </template>
    <template #foot="{close, submit}">
      <el-button @click="submit()">插槽的确认</el-button>
      <el-button @click="close()">插槽的取消</el-button>
    </template>
    <div>
      footAlign设置底部按钮的位置，居中或者居右<br/>
      <CusFormColumn
          :span="24"
          link="radio"
          label="底部按钮位置"
          v-model:param="footAlign"
          :options="[
              {label: 'center', value: 'center'},
              {label: 'right', value: 'right'},
          ]"
          static
          labelKey="label"
          valueKey="value"
      />
      footPadding设置底部按钮的padding，与padding结构一致，默认"16px 26px"<br/>
      foot插槽包含原始的确认、取消按钮的方法<br/>
      showClose、showSubmit控制是否显示预设的确认、取消按钮<br/>
      <CusFormColumn
          :span="24"
          link="switch"
          label="是否显示确认"
          v-model:param="showSubmit"
      />
      <CusFormColumn
          :span="24"
          link="switch"
          label="是否显示取消"
          v-model:param="showClose"
      />
    </div>
  </CusDialog>
</template>

<script lang="ts">
import {
  defineComponent,
  computed,
  onMounted,
  ref,
  reactive,
  watch,
  getCurrentInstance,
  ComponentInternalInstance,
  toRefs,
  nextTick
} from 'vue'
import {useStore} from 'vuex'
import {useRouter, useRoute} from 'vue-router'

export default defineComponent({
  name: '',
  components: {},
  props: {
    show: {}
  },
  setup(props, {emit}) {
    const store = useStore();
    const router = useRouter();
    const route = useRoute();
    const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
    const state = reactive({
      footAlign: 'center',
      showClose: true,
      showSubmit: true
    })
    return {
      ...toRefs(state)
    }
  },
})
</script>

<style scoped lang="scss">
.head-slot {
  color: red;
}
</style>
