Dialog 对话框
基础用法
展开查看
vue
<template>
<tass-button type="primary" :visible="!normalVisible" @click="changeView">dialog</tass-button>
<tass-dialog
:visible="normalVisible"
width="500px"
@cancel="handleClickCancelButton"
@confirm="handleConfirmButton"
>
</tass-dialog>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
let normalVisible = ref(false);
changeView = () => {
normalVisible.value = !normalVisible.value;
};
handleClickCancelButton = () => {
normalVisible.value = !normalVisible.value;
};
handleConfirmButton = () => {
normalVisible.value = !normalVisible.value;
};
</script>
自定义内容
通过设置 title,来展示自定义内容。
展开查看
vue
<template>
<tass-button type="primary" :visible="!normalVisible" @click="changeView">自定义内容</tass-button>
<tass-dialog
:visible="normalVisible"
title="自定义内容"
width="500px"
@cancel="handleClickCancelButton"
@confirm="handleConfirmButton"
>
</tass-dialog>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
let normalVisible = ref(false);
changeView = () => {
normalVisible.value = !normalVisible.value;
};
handleClickCancelButton = () => {
normalVisible.value = !normalVisible.value;
};
handleConfirmButton = () => {
normalVisible.value = !normalVisible.value;
};
</script>