关于这件事,本来用笨办法在每一个a-select组件中都加了
<a-select>
<template #suffixIcon><i class="iconfont icon-a-jiantoubeifen8"></i></template>
<a-select-option>
{{ item.name }}
</a-select-option>
</a-select>
可以是可以但是到了分页器或者其他深层的封装就不适用了,后续问了同事发现可以在引入antd组件的文件中这么写
但,可能因为库的问题标签在这里并不适用,会报 h is not defined 的错
于是又问了大佬得到了解决方案修改如下:
const a = new Vue()
// console.log(Vue.$createElement, a.$createElement);
Select.props.suffixIcon.default = () => {
const h = a.$createElement;
return h('i', {
'class': {
iconfont: true,
'icon-a-jiantoubeifen8': true
},
attrs: {
style: 'color: #A8A8A8;'
},
},)
}
哭了大佬就是大佬
———————————————————————————————————————————
//分页器图标修改
pagination: {
itemRender(current, type, originationElement) {
if (type == 'prev') {
return (
<i
class="iconfont icon-a-jiantoubeifen8"
style="color: #9ea6b0"
></i>
)
} else if (type == 'next') {
return (
<i
class="iconfont icon-a-jiantoubeifen8 arrow_next"
style="color: #9ea6b0"
></i>
)
} else {
return originationElement
}
},
},