-
Ant Design Vue 3日期组件报错 TypeError: clone.weekday is not a function
Ant Design Vue 3日期组件在初始化赋值时 报错:TypeError: clone.weekday is not a function 解决方法 import dayjs from "dayjs"; import weekday from "dayjs/plugin/weekday" import localeData from "dayjs/plugin/localeData" dayjs.extend(weekday) dayjs.extend(localeData)2022-5-20 0 2466 标签: vue ant design -
Ant Design Vue 3动态引用图标
在新项目上首次使用了Ant Design Vue 3.2.3 在做动态导航的时候遇到了一个很棘手的问题:无法动态引用图标。 官方给的例子是按需引入的。 <template> <home-outlined /> <setting-filled /> <smile-outlined /> <sync-outlined/> <smile-outlined/> <loading-outlined /> </template> <script> import { defineComponent } from 'vue'; import { HomeOutlined, SettingFilled, SmileOutlined, SyncOutlined, LoadingOutlined } from '@ant-design/icons-vue'; export default defineComponent({ components: { HomeOutlined, SettingFilled, SmileOutlined, SyncOutlined, LoadingOutlined, }, }); </script> 解决方法: 1、新建文件/components/amanIcon.js import {createVNode} from 'vue' import * as ICONS from '@ant-design/icons-vue' export const amanIcon = (props) => { let { icon } = props; icon = icon.split("-").map((g) => { return g[0].toUpperCase() + g.slice(1) }).join('') return createVNode(ICONS[icon]); }; 2、使用场景 <template> //大小驼峰都可以 <amanIcon icon="AppstoreOutlined"> <amanIcon icon="appstore-outlined"> </template> <script> import {amanIcon} from "@/components/amanIcon"; export default defineComponent({ components: { amanIcon, }, }); </script>2022-5-9 0 2045 标签: vue ant design

最新评论
Aman 2年前
@阿巴阿巴:define
阿巴阿巴 3年前
如果waf屏蔽了$该怎么绕啊楼主
Aman 3年前
@啊啊:没有,等有空我完善下打包成插件
啊啊 3年前
博主 这个有视频教程吗 没看懂....
Aman 3年前
@波波:密码随意
波波 3年前
这句话的怎么连接啊,楼主
Aman 3年前
Hi