❤ 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}`);
};
相关推荐
卸任几秒前
Electron霸屏功能总结
前端·react.js·electron
fengci.几秒前
ctfshow黑盒测试前半部分
前端
忆琳2 分钟前
Vue3 优雅解决单引号注入问题:自定义指令 + 全局插件双方案
vue.js·element
忆琳8 分钟前
Vue3 全局自动大写转换:一个配置,全站生效
javascript·element
喵个咪12 分钟前
Headless 架构优势:内容与展示解耦,一套 API 打通全端生态
前端·后端·cms
小江的记录本15 分钟前
【JEECG Boot】 JEECG Boot——数据字典管理 系统性知识体系全解析
java·前端·spring boot·后端·spring·spring cloud·mybatis
喵个咪18 分钟前
传统 CMS 太笨重?试试 Headless 架构的 GoWind,轻量又强大
前端·后端·cms
chenjingming66620 分钟前
jmeter导入浏览器上按F12抓的数据包
前端·chrome·jmeter
张元清20 分钟前
不用 Server Components 也能做 React 流式 SSR —— 实战指南
前端·javascript·面试