zs
2025-05-08 67ccbefb82b868fa1aa4bada181ed9dd2ddf92b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { computed, defineComponent, onMounted, ref } from 'vue'
import styles from './BaseDrawer.module.scss'
import Icon from '../Icon/Icon'
//@ts-ignore
export default defineComponent<{
  [key: string]: any
}>({
  // @ts-ignore
  name: 'BaseDrawer',
  props: {
    // 遮罩是否可点击
    clickable: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: '',
    },
    width: {
      type: String,
      default: '',
    },
    // modelValue: {
    //   type: Boolean,
    //   default: false,
    // },
  },
  emits: ['close', 'confirm', 'update:modelValue', 'open', 'beforeClose'],
  setup(props: any, { emit, slots, attrs }: any) {
    // const size = computed(() => {
    //   if (attrs.size.includes('px')) {
    //     return attrs.size
    //   }
    // })
 
    // const model = computed(() => {
    //   if (attrs.model.includes('')) {
    //     return attrs.model
    //   }
    // })
 
    return () => {
      return (
        <div
          class={styles.drawContent}
          //@ts-ignore
          // style={props.clickable ? { '--drawer-width': size.value } : {}}
        >
          <el-drawer
            // modal-class={props.clickable ? styles.modal : ''}
            class={{
              [styles.informationDrawer]: true,
              // [styles.informationDrawerPosition]: props.clickable,
            }}
            onOpen={() => emit('open')}
            onClose={() => emit('close')}
            v-slots={{
              footer() {
                return (
                  <div class={styles.csDialogFooter}>
                    <el-button
                      onClick={() => emit('close')}
                      type="info"
                      plain
                      class={{
                        [styles.dialogBtn]: true,
                        [styles.csBaseBtn]: true,
                      }}
                    >
                      取消
                    </el-button>
                    <el-button
                      onClick={() => emit('confirm')}
                      type="primary"
                      class={{
                        [styles.csBaseBtn]: true,
                      }}
                    >
                      确认
                    </el-button>
                  </div>
                )
              },
            }}
            {...attrs}
            title={props.title}
            size={props.width || attrs.size}
          >
            <Icon
              width={167}
              height={54}
              class={styles.iconPosition}
              icon="drawer_bg"
            />
            {slots.default?.()}
          </el-drawer>
        </div>
      )
    }
  },
})