vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决(antdesign,elementui,vue,开发技术)

时间:2024-05-04 00:36:40 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

vue在antDesign或elementUI组件native事件中触发2次

vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决

打印event.target

vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决

核心思想是设置下event.target的过滤

vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决

运用ant-design-vue组件库,且在项目中遇到的问题

难以改变的默认样式

可能大家在运用到组件库的时候都会遇到要改变其组件自带的样式,组件自带的都难以去改变,下面来看看,这种方法很有效果。。。。。

首先,!important

对于一般的组件样式,找到你要改变其组件的class名,在样式后加上!important,它的权重比较高,。

.ant-select{width:145px!important;}.happy-scroll-content{width:100%!important;}

其次,/deep/

/deep/.happy-scroll-content{width:100%!important;}

最后,如果以上两个都不好用,::v-deep最好的选择

::v-deep.ant-col{margin-bottom:7px;}

让通知提醒框的内容自动换行

一撮内容,在js的地盘,也不可能让我在里面插入个<br/>或者\n,而且还是从后端返回的多条数据,最终还是解决了&hellip;

没改变之前,是这个样子的

openNotification(){this.$notification.open({message:'NotificationTitle',description:'Iwillnevercloseautomatically.Iwillbecloseautomatically.Iwillnevercloseautomatically.',duration:0,});},

vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决

运用了descriptionAPI的特性,function(h),可以理解是vue里的一个render函数里面的createElement,这里就不过多讲解,直接贴代码了,效果如下:

this.$notification[type]({message:h=>{returnh('div',{style:{'font-size':'14px'}},str)},description:h=>{returnh("div",this.tips.map(function(item){returnh('li',{style:{'font-size':'12px'}},item)//可以改变其li的样式}));},duration:10,});

vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决

table组件表格出现时间时,格式问题

对于后端返回的数据,有的数据直接渲染就可以,但是有的还要改变其格式,方可展示,那就用到了customRender,当然也少不了时间格式的转换moment

importmomentfrom"moment";constformatterTime=val=>{returnval?moment(val).format("YYYY-MM-DDHH:mm:ss"):"";};

在需要改变的数据columns中,加上customRender,就能实现时间格式的转换了

{title:"上传时间",dataIndex:"updateTime",width:'20%',customRender:(text,row,index)=>{return(<ahref="javascript:;"rel="externalnofollow">{formatterTime(text)}</a>);}},

当你遇到这样的bug时,可能出现了这样的问题

vue.runtime.esm.js?0261:619 [Vue warn]: Error in render: “TypeError:

Cannot read property &lsquo;0&rsquo; of undefined”

出现这个错误的原因其实是Vue在拿到数据之前就渲染了dom,那么在你的html结构中加上v-if,某个数据的长度,如:

v-if="dataList.length>0

“ReferenceError: h is not defined”

原因:在用到colums,没放到data里定义,会报错

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:vue在antDesign框架或elementUI框架组件native事件中触发问题怎么解决的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:Vue怎么实现父子组件页面刷新下一篇:

16 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18