IT评测·应用市场-qidao123.com技术社区
标题:
uniapp 通过标签天生海报
[打印本页]
作者:
写过一篇
时间:
2024-9-28 10:20
标题:
uniapp 通过标签天生海报
1.下载插件
添加 海报画板 - DCloud 插件市场 到你的uniapp项目
2.设置模版
按照需求画出需要的海报
<view class="poster">
<l-painter ref='painter' isCanvasToTempFilePath :css="`width: 600rpx;height:${height*1.6}rpx;`">
<l-painter-view
:css="`box-sizing: border-box; background: #fff; width: 600rpx;background-color:#999;height:${height*1.6}rpx;`">
<l-painter-image :src="tempImg"
:css="`object-fit: cover; object-position: 50% 50%;width: 600rpx; height:${height*1.6}rpx; border-radius: 12rpx;`" />
<l-painter-image src="/static/picture/logo.png"
css="position:absolute;width:600rpx;height:208rpx;top:0;left:0;" />
<l-painter-image src="/static/picture/z1.png"
css="position:absolute;width:320rpx;height:184rpx;top:224rpx;left:-60rpx;" />
<l-painter-image src="/static/picture/z2.png"
css="position:absolute;width:240rpx;height:264rpx;top:368rpx;right:0;" />
<l-painter-image src="/static/picture/z3.png"
css="position:absolute;width:192rpx;height:224rpx;top:504rpx;" />
<l-painter-image src="/static/picture/z4.png"
css="position:absolute;width:160rpx;height:160rpx;top:720rpx;right:0;" />
</l-painter-view>
</l-painter>
</view>
复制代码
3.天生海报
this.$refs.painter.canvasToTempFilePathSync({
fileType: "jpg",
pathType: 'url',
quality: 1,
success: (res) => {
// 拿到路径,进行其他处理
console.log( res.tempFilePath );
}
});
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
欢迎光临 IT评测·应用市场-qidao123.com技术社区 (https://dis.qidao123.com/)
Powered by Discuz! X3.4