我们使用h函数来创建img标签,并设置其src和alt属性来显示图片;值得注意的是此处图片的引入方式是require标签的引入方式;如果项目中使用了eslint,则需要在eslint配置中做特定的配置修改,不然eslint会报错common.js的写法
notice(){
this.$Notice.success({
title: 'Notification title',
desc: 'The desc will hide when you set render.',
closable: true,
position:'bottom= 500px',
render: h => {
return h('div', { class: 'notice-center' }, [
h('img', {
attrs: {
src: require("../../assets/images/XXX.png"),
alt: 'Image',
},
style: {
width: '50px',
height: '50px',
},
}),
]);
}
});
}