mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-04 04:08:34 +08:00
ee7a21f670
feat(components): [message-box] can drag overflow the viewport
30 lines
742 B
Vue
30 lines
742 B
Vue
<template>
|
|
<el-button plain @click="open">Click to open Message Box</el-button>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
const open = () => {
|
|
ElMessageBox.prompt('Please input your e-mail', 'Tip', {
|
|
confirmButtonText: 'OK',
|
|
cancelButtonText: 'Cancel',
|
|
inputPattern:
|
|
/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
|
|
inputErrorMessage: 'Invalid Email',
|
|
})
|
|
.then(({ value }) => {
|
|
ElMessage({
|
|
type: 'success',
|
|
message: `Your email is:${value}`,
|
|
})
|
|
})
|
|
.catch(() => {
|
|
ElMessage({
|
|
type: 'info',
|
|
message: 'Input canceled',
|
|
})
|
|
})
|
|
}
|
|
</script>
|