❤ Ant Design Vue 2.28的使用

❤ Ant Design Vue 2.28

弹窗

js 复制代码
//按钮
<a-button type="primary" @click="showModal">Open Modal</a-button>

//窗口
<a-modal v-model:visible="visible" title="Basic Modal" @ok="handleOk">
      <p>Some contents...</p>
      <p>Some contents...</p>
      <p>Some contents...</p>
</a-modal>


<script lang="ts">
import { defineComponent, ref } from 'vue'; //引入 
export default defineComponent({
  setup() {
    const visible = ref<boolean>(false); //定义窗口开关
	//定义窗口事件
    const showModal = () => {
      visible.value = true;
    };
	//窗口事件
    const handleOk = (e: MouseEvent) => {
      console.log(e);
      visible.value = false;
    };
    //返回数值
    return {
      visible,
      showModal,
      handleOk,
    };
  },
});
</script>

下拉框

js 复制代码
<a-select
      ref="select"
      v-model:value="value1"
      style="width: 120px"
      @focus="focus"
      @change="handleChange">
      <a-select-option value="jack">Jack</a-select-option>
      <a-select-option value="lucy">Lucy</a-select-option>
      <a-select-option value="disabled" disabled>Disabled</a-select-option>
      <a-select-option value="Yiminghe">yiminghe</a-select-option>
</a-select>

//数据
const options1 = ref<SelectTypes['options']>([
      {
        value: 'jack',
        label: 'Jack',
      },
      {
        value: 'lucy',
        label: 'Lucy',
      },
      {
        value: 'disabled',
        label: 'Disabled',
        disabled: true,
      },
      {
        value: 'yiminghe',
        label: 'Yiminghe',
      },
]);



//方法
const focus = () => {
      console.log('focus');
    };

const handleChange = (value: string) => {
      console.log(`selected ${value}`);
};
相关推荐
天平6 小时前
油猴脚本创建webworker踩坑记录
前端·javascript·typescript
原则猫8 小时前
前端基础大厦
前端
陈随易9 小时前
编程语言级别的Skill市场,AI Agent 的未来形态
前端·后端·程序员
SoaringHeart10 小时前
Flutter进阶:基于 EasyRefresh 的下拉刷新封装 n_easy_refresh_mixin.dart
前端·flutter
IT_陈寒12 小时前
Vite的热更新突然不香了,排查三小时差点砸键盘
前端·人工智能·后端
子兮曰12 小时前
Agency-Agents 深度解析:400+ AI 专家的"梦之队"如何重塑开发工作流
前端·后端·vibecoding
山河木马13 小时前
渲染管线-计算得到gl_Position(顶点着色器)之后续GPU流程
javascript·webgl·图形学
竹林81813 小时前
用 The Graph 查询链上数据实战:从手搓 RPC 到 Subgraph,我的 NFT 项目数据加载快了 10 倍
前端·javascript
妙码生花13 小时前
从 PHP 到 AI + Golang,程序员自救转型手记(十九):点选验证码代码逐行目检
前端·后端·go
Awu122714 小时前
⚡从零开发 Agent CLI(五)实现一个可治理、可扩展的工具系统
前端·人工智能·claude