mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 18:11:48 +08:00

* perf: change to import-x * feat: add rules * chore: fix rule * chore: fix * chore: fix * chore: fix * style: `pnpm lint:fix` * Revert "style: `pnpm lint:fix`" This reverts commit db0116a288299c507e3cfc4d7a22e2207265d920. * Revert "chore: fix" This reverts commit 69c82a90c01525e38180be4c21e8ef5602512318. * chore: fix * style: `pnpm lint:fix` * fix: lint * chore: `pnpm format`
79 lines
2.0 KiB
Vue
79 lines
2.0 KiB
Vue
<template>
|
|
<el-radio-group v-model="direction">
|
|
<el-radio value="ltr">left to right</el-radio>
|
|
<el-radio value="rtl">right to left</el-radio>
|
|
<el-radio value="ttb">top to bottom</el-radio>
|
|
<el-radio value="btt">bottom to top</el-radio>
|
|
</el-radio-group>
|
|
|
|
<el-button type="primary" style="margin-left: 16px" @click="drawer = true">
|
|
open
|
|
</el-button>
|
|
<el-button type="primary" style="margin-left: 16px" @click="drawer2 = true">
|
|
with footer
|
|
</el-button>
|
|
|
|
<el-drawer
|
|
v-model="drawer"
|
|
title="I am the title"
|
|
:direction="direction"
|
|
:before-close="handleClose"
|
|
>
|
|
<span>Hi, there!</span>
|
|
</el-drawer>
|
|
<el-drawer v-model="drawer2" :direction="direction">
|
|
<template #header>
|
|
<h4>set title by slot</h4>
|
|
</template>
|
|
<template #default>
|
|
<div>
|
|
<el-radio v-model="radio1" value="Option 1" size="large">
|
|
Option 1
|
|
</el-radio>
|
|
<el-radio v-model="radio1" value="Option 2" size="large">
|
|
Option 2
|
|
</el-radio>
|
|
</div>
|
|
</template>
|
|
<template #footer>
|
|
<div style="flex: auto">
|
|
<el-button @click="cancelClick">cancel</el-button>
|
|
<el-button type="primary" @click="confirmClick">confirm</el-button>
|
|
</div>
|
|
</template>
|
|
</el-drawer>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
import { ElMessageBox } from 'element-plus'
|
|
|
|
import type { DrawerProps } from 'element-plus'
|
|
|
|
const drawer = ref(false)
|
|
const drawer2 = ref(false)
|
|
const direction = ref<DrawerProps['direction']>('rtl')
|
|
const radio1 = ref('Option 1')
|
|
const handleClose = (done: () => void) => {
|
|
ElMessageBox.confirm('Are you sure you want to close this?')
|
|
.then(() => {
|
|
done()
|
|
})
|
|
.catch(() => {
|
|
// catch error
|
|
})
|
|
}
|
|
function cancelClick() {
|
|
drawer2.value = false
|
|
}
|
|
function confirmClick() {
|
|
ElMessageBox.confirm(`Are you confirm to chose ${radio1.value} ?`)
|
|
.then(() => {
|
|
drawer2.value = false
|
|
})
|
|
.catch(() => {
|
|
// catch error
|
|
})
|
|
}
|
|
</script>
|