Laravel  
laravel
文档
数据库
架构
入门
php技术
    
Laravelphp
laravel / php / java / vue / mysql / linux / python / javascript / html / css / c++ / c#

vue antdesign

作者:昂首向前走,   发布日期:2025-12-25   浏览:87

<template>
  <a-layout>
    <a-layout-header>Header</a-layout-header>
    <a-layout-content>
      <a-button type="primary">Button</a-button>
    </a-layout-content>
    <a-layout-footer>Footer</a-layout-footer>
  </a-layout>
</template>

<script>
import { defineComponent } from 'vue';
import { Layout, Button } from 'ant-design-vue';

export default defineComponent({
  components: {
    ALayout: Layout,
    ALayoutHeader: Layout.Header,
    ALayoutContent: Layout.Content,
    ALayoutFooter: Layout.Footer,
    AButton: Button,
  },
});
</script>

<style>
#components-layout-demo-basic {
  text-align: center;
}
#components-layout-demo-basic .ant-layout-header,
#components-layout-demo-basic .ant-layout-footer {
  background: #7dbcea;
  color: #fff;
}
#components-layout-demo-basic .ant-layout-footer {
  line-height: 1.5;
}
#components-layout-demo-basic .ant-layout-content {
  background: rgba(16, 142, 233, 1);
  color: #fff;
  min-height: 120px;
  line-height: 120px;
}
#components-layout-demo-basic > .ant-layout {
  margin-bottom: 48px;
}
#components-layout-demo-basic > .ant-layout:last-child {
  margin: 0;
}
</style>

解释说明

  1. 模板部分 (<template>):

    • 使用了 ant-design-vue 提供的布局组件 (a-layout, a-layout-header, a-layout-content, a-layout-footer) 来创建一个简单的页面布局。
    • 在内容区域中添加了一个按钮 (a-button),并设置了按钮类型为 primary
  2. 脚本部分 (<script>):

    • 使用了 Vue 3 的 defineComponent 方法来定义组件。
    • 引入了 ant-design-vue 中的 LayoutButton 组件,并在 components 中进行了注册。
  3. 样式部分 (<style>):

    • 定义了一些基本的样式来美化布局和按钮,例如设置背景颜色、文本颜色和行高。

上一篇:vue clipboard

下一篇:vue3 vuedraggable

大家都在看

vue.js devtools用法

vue js for循环

highlight.js vue

vue.config.js 配置

vue.config.js 配置代理

vue.config.js configu

node.js vue

vue3 写法

vue3组件传值的方式

vue3 子路由

Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3

Laravel 中文站