❤ 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}`);
};
相关推荐
Java展博8 小时前
[前端够用就好] 跨域报错时,浏览器到底在拦谁
前端·状态模式
用户112936112198 小时前
npm 都提示成功了,node_modules 为什么还占着 370M?
linux·前端·后端
掘金安东尼9 小时前
Agent Harness 也有 benchmark:评分榜与评测工作台现状
前端·agent
digger_4199 小时前
从零理解 Electron:主进程、渲染进程、preload 与 IPC 实战
前端·electron
去伪存真10 小时前
别让你的 RAG 平台“花五份钱、答一份结巴的题”:幂等性架构的自我修养
前端·agent
snow@li11 小时前
前端:导入EXCEL并解析文件内容,demo
前端·javascript·vue.js
补码缩写12 小时前
压缩PNG不损失透明:只量化RGB、alpha原样留的减色流程
前端
RuoyiOffice12 小时前
Flowable只是起点:一套OA背后的单据、资源与协作设计
java·vue.js·spring boot·flowable·企业管理·oa·ruoyi office
TDengine (老段)12 小时前
TDengine IDMP 知识库与知识图谱
大数据·前端·物联网·知识图谱·时序数据库·tdengine·涛思数据
goehou13 小时前
PNG 转 WebP 不一定变小,我量了三类图
前端·性能优化·webp·sharp