<template>
<a-layout>
<a-layout-header>Header</a-layout-header>
<a-layout-content>
<a-button type="primary" @click="handleClick">Click me!</a-button>
</a-layout-content>
<a-layout-footer>Footer</a-layout-footer>
</a-layout>
</template>
<script setup>
import { message } from 'ant-design-vue';
const handleClick = () => {
message.success('Button clicked!');
};
</script>
<style scoped>
/* Add some basic styles */
a-layout {
min-height: 100vh;
}
a-layout-header, a-layout-footer {
background: #001529;
color: white;
text-align: center;
line-height: 64px;
}
a-layout-content {
padding: 20px;
text-align: center;
}
</style>
模板部分 (<template>):
a-layout 组件来创建一个基础的布局结构,包括头部 (a-layout-header)、主体 (a-layout-content) 和底部 (a-layout-footer)。a-button),并绑定了点击事件。脚本部分 (<script setup>):
message 模块,用于显示消息提示。handleClick 方法,在按钮点击时调用,并显示一个成功消息。样式部分 (<style scoped>):
上一篇:vue长按事件怎么写
下一篇:vue 函数式组件
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站