国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

uniapp微信小程序生成分享海報(模板自取)

這篇具有很好參考價值的文章主要介紹了uniapp微信小程序生成分享海報(模板自取)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

uniapp微信小程序生成分享海報模板

1、模板自取

2、可自行按需求更改調(diào)整

3、效果圖如下: 生成前? -----> 生成后的圖

小程序分享生成海報,小程序,微信小程序,uni-app,小程序小程序分享生成海報,小程序,微信小程序,uni-app,小程序

需知:博主的實(shí)現(xiàn)效果是先把需要生成的圖片排版成靜態(tài)頁面,再點(diǎn)擊生成海報----->通過canvas生成海報?。?!

? ? ? ? ? ?不需要這樣效果話可以省略第一步,直接一進(jìn)頁面調(diào)用方法生成canvas海報?。。? 示例大部分代碼可省略?)

4、全部代碼如下所示:

html:

<template>
?? ?<view class="container">
?? ? ? <view class="bigTitle">分享簽到</view>
?? ? ? <view class="bigTitleTwo">堅(jiān)持打卡學(xué)習(xí),和我一起吧!</view>
?? ??? ?
? ? ? <view class="shareBox">
?? ??? ?<view class="topTime">
?? ??? ??? ?<view class="topItem">{{todayTime}}</view>
?? ??? ??? ?<view class="topItem">{{today}}</view>
?? ??? ?</view>
?? ??? ?<!-- <u--image mode="widthFix" :showLoading="true" :src="mainPic" width="400rpx" height="400rpx"></u--image> -->
? ? ? ? <image :src="mainPic" mode="widthFix" class='bgImg'></image>
? ? ? ? <view class="shareText">
? ? ? ? ?<view class='text'>
?? ??? ??? ? <rich-text :nodes="todaySaying || '-'"></rich-text>
?? ??? ? </view>
? ? ? ? ? <!-- <text class='text text2'> ———— 周杰倫《晴天》</text> -->
? ? ? ? </view>
? ? ?
? ? ? ? <view class='imgBox'>
? ? ? ? ? <button open-type="share" class='zfbtn'>
? ? ? ? ? ? <image src="http://www.meitang.cn/static/img/images/share_weixin.png" class='img'></image>
? ? ? ? ? ? ?<text class='btntxt'>分享朋友</text>
? ? ? ? ? </button>
? ? ? ? ? <button class='zfbtn m_l' @click="formSubmit">
? ? ? ? ? ? <image src="http://www.meitang.cn/static/img/images/share_fuzhi.png" class='img'></image>
? ? ? ? ? ? <text class='btntxt'>生成海報</text>
? ? ? ? ? </button>
? ? ? ? </view>
? ? ??
? ? ? ? <!--生成海報后的圖 ?-->
? ? ? ? ? <view class='imagePathBox' :hidden="maskHidden == false">
? ? ? ? ? ? <image :src="imagePath" class='shengcheng' show-menu-by-longpress="true"></image>
? ? ? ? ? ? <button class='baocun' @click="baocun">保存相冊,分享到朋友圈</button>
? ? ? ? ? </view>
? ? ? ? ?<view :hidden="maskHidden == false" class="mask"></view>?
? ? ? ? <view class="canvas-box">
?? ??? ??? ?<!-- style="width: 500rpx;height: 840rpx;position:fixed;" -->
? ? ? ? ? ? <canvas canvas-id="mycanvas" style="width: 750rpx;height: 1334rpx;position:fixed;" />
? ? ? ? </view> ?
? ? ? </view>
?? ?</view>
? ?
</template>

? ? data數(shù)據(jù):

?? ?data() {
?? ??? ??? ?return {
?? ??? ??? ? ? formatDate,
?? ??? ??? ? ? imgView:this.$api.viewFile,
?? ??? ??? ? ? canvasW:375, ? ? // 設(shè)備寬
? ? ? ? ? ? ? ?img: "1654073743713419267",
? ? ? ? ? ? ? ?maskHidden: false,
? ? ? ? ? ? ? ?name: "野生九五",
?? ??? ??? ? ? todaySaying:'好運(yùn)永遠(yuǎn)不會眷顧傻瓜',
?? ??? ??? ? ? imagePath:'', ? ?// 顯示生成的圖片
?? ??? ??? ? ? mainPic: this.$api.viewFile + '1654305599822200833',
?? ??? ??? ? ? erPic: this.$api.viewFile + '20230518001',
?? ??? ??? ? ? todayTime:'2023-03-18',
?? ??? ??? ? ? today:'星期一',
?? ??? ??? ? ? urlParams:{}, ? // 路由參數(shù)
?? ??? ??? ?}
?? ??? ?},

onShow():

?? ?onShow() {

? ? ? ? // 獲取屏幕的寬度為畫布寬
?? ??? ?let that = this
?? ??? ?uni.getSystemInfo({
?? ??? ??? ?success(res) {
?? ??? ??? ??? ?let { windowWidth } = res
?? ??? ??? ??? ?that.canvasW = windowWidth
?? ??? ??? ?}
?? ??? ?});
?? ??? ?
?? ??? ? this.getShareImgInfo(); ? // 獲取內(nèi)容信息
?? ??? ?
?? ?},

方法:

?? ? methods: {
?? ??? ??? ?
?? ??? ??? ?/* 獲取分享圖片上的內(nèi)容信息 */
?? ??? ??? ?async getShareImgInfo(){
?? ??? ??? ??? ?let { indexContent } = this.urlParams
?? ??? ??? ??? ?try{
?? ??? ??? ??? ??? ?let res = await this.$api.getShareImgInfo()
?? ??? ??? ??? ??? ?if(res.code === 200){
?? ??? ??? ??? ??? ??? ?let { content,img,localDate,week } = res.data
?? ??? ??? ??? ??? ??? ?this.mainPic = this.$api.viewFile + (img === null ? '1654305599822200833' : img )
?? ??? ??? ??? ??? ??? ?this.todayTime = localDate
?? ??? ??? ??? ??? ??? ?this.todaySaying = indexContent ? indexContent : content
?? ??? ??? ??? ??? ??? ?this.today = week
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?}catch(e){
?? ??? ??? ??? ??? ?
?? ??? ??? ??? ?}
?? ??? ??? ?},
?? ??? ??? ??? ?
?? ??? ??? ?
?? ??? ??? ?// 獲取圖片信息
?? ??? ??? ?getImageInfo(image) {
?? ??? ??? ??? ?return new Promise((req, rej) => {
?? ??? ??? ??? ??? ?uni.getImageInfo({
?? ??? ??? ??? ??? ??? ?src: image,
?? ??? ??? ??? ??? ??? ?success: function(res) {
?? ??? ??? ??? ??? ??? ??? ?req(res)
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ?});
?? ??? ??? ??? ?})
?? ??? ??? ?},
?? ??? ??? ? ?/* ?canvas文本換行 */
?? ??? ??? ??? ?drawText (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth) {
?? ??? ??? ??? ? ? ?let lineWidth = 0;
?? ??? ??? ??? ? ? ?let lastSubStrIndex = 0; //每次開始截取的字符串的索引
?? ??? ??? ??? ? ? ?for (let i = 0; i < str.length; i++) {
?? ??? ??? ??? ? ? ? ? ?lineWidth += ctx.measureText(str[i]).width;
?? ??? ??? ??? ? ? ? ? ?if (lineWidth > canvasWidth) {
?? ??? ??? ??? ? ? ? ? ? ? ?ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); //繪制截取部分
?? ??? ??? ??? ? ? ? ? ? ? ?initHeight += 22; //22為 文字大小20 + 2
?? ??? ??? ??? ? ? ? ? ? ? ?lineWidth = 0;
?? ??? ??? ??? ? ? ? ? ? ? ?lastSubStrIndex = i;
?? ??? ??? ??? ? ? ? ? ? ? ?titleHeight += 22;
?? ??? ??? ??? ? ? ? ? ?}
?? ??? ??? ??? ? ? ? ? ?if (i == str.length - 1) { //繪制剩余部分
?? ??? ??? ??? ? ? ? ? ? ? ?ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
?? ??? ??? ??? ? ? ? ? ?}
?? ??? ??? ??? ? ? ?}
?? ??? ??? ??? ? ? ?// 標(biāo)題border-bottom 線距頂部距離
?? ??? ??? ??? ? ? ?titleHeight = titleHeight + 10;
?? ??? ??? ??? ? ? ?return titleHeight;
?? ??? ??? ??? ?},

?? ??? ??? ??? ?
? ? ? ? ? ? ? ? ?//將canvas轉(zhuǎn)換為圖片保存到本地,然后將圖片路徑傳給image圖片的src
? ? ? ? ? ? ? async createNewImg() {
? ? ? ? ? ? ? ? ?let that = this;
?? ??? ??? ??? ? let { mainPic,erPic,name,todaySaying,todayTime,today,canvasW } = this
?? ? ? ? ? ? ? ?
?? ??? ??? ??? ? this.mainPic = await this.getImageInfo(mainPic) ? ?// 處理圖片
?? ??? ??? ??? ? this.erPic = await this.getImageInfo(erPic) ? ? ? ?// 處理圖片
?? ??? ??? ??? ? ?
? ? ? ? ? ? ? ? ?var context = uni.createCanvasContext('mycanvas');
? ? ? ? ? ? ? ? ?context.setFillStyle("#FFF") ? ? ?// #F24077 ? ? ? ? ? ?// 背景顏色
? ? ? ? ? ? ? ? ?context.fillRect(0, 0, canvasW, 610) ? ? ? ? ? ? ?// ?667 繪制一個矩形作為背景矩形x坐標(biāo)、y坐標(biāo)、圖片寬、高
?? ??? ??? ??? ??
?? ??? ??? ??? ? context.setFontSize(26);
?? ??? ??? ??? ? context.setFillStyle('#000'); ? ? // #FFF
?? ??? ??? ??? ? context.setTextAlign('left');
?? ??? ??? ??? ? context.fillText("分享簽到", 37, 45);
?? ??? ??? ??? ? context.stroke();
?? ??? ??? ??? ? context.setFontSize(14);
?? ??? ??? ??? ? context.setFillStyle('#000');
?? ??? ??? ??? ? context.setTextAlign('left');
?? ??? ??? ??? ? context.fillText("堅(jiān)持打卡學(xué)習(xí),和我一起吧!", 37, 75);
?? ??? ??? ??? ? context.stroke();
?? ??? ??? ??? ??
?? ??? ??? ??? ? context.setFontSize(14);
?? ??? ??? ??? ? context.setFillStyle('#333');
?? ??? ??? ??? ? context.setTextAlign('left');
?? ??? ??? ??? ? context.fillText(todayTime, 37, 100);
?? ??? ??? ??? ? context.stroke();
?? ??? ??? ??? ??
?? ??? ??? ??? ? context.setFontSize(16);
?? ??? ??? ??? ? context.setFillStyle('#333');
?? ??? ??? ??? ? context.setTextAlign('right');
?? ??? ??? ??? ? context.fillText(today, (canvasW - 37), 100);
?? ??? ??? ??? ? context.stroke();
?? ??? ??? ??? ??
?? ??? ??? ??? ??
? ? ? ? ? ? ? ? ?context.drawImage(this.mainPic.path, (canvasW - 300)/2, 110, 300, 320); ?// 262 349

? ? ? ? ? ? ? ? ?// context.drawImage(path2, 56, 400, 263, 121); ?// 繪制圖像到畫布src、x坐標(biāo)、y坐標(biāo)、圖片寬、高?
? ? ? ? ? ? ? ? ?
?? ??? ??? ??? ? // 今日上上簽
?? ??? ??? ? ? ? context.setFontSize(15);
?? ??? ??? ? ? ? context.setFillStyle('#333');
?? ??? ??? ? ? ? context.setTextAlign('left');
?? ??? ??? ? ? ? // context.fillText(todaySaying, 37, 480);
?? ??? ??? ??? ? this.drawText(context, todaySaying, 37, 470, 30, 300); ? // 調(diào)用行文本換行函數(shù)(300則換行)
?? ??? ??? ? ? ? context.stroke();
?? ??? ??? ? ??
? ? ? ? ? ? ? ? ?//繪制左下角文字
? ? ? ? ? ? ? ? ?context.setFontSize(12);
? ? ? ? ? ? ? ? ?context.setFillStyle('#333');
? ? ? ? ? ? ? ? ?context.setTextAlign('left');
? ? ? ? ? ? ? ? ?context.fillText("長按識別小程序", 80, 560);
? ? ? ? ? ? ? ? ?context.stroke();
? ? ? ? ? ? ? ? ?context.setFontSize(12);
? ? ? ? ? ? ? ? ?context.setFillStyle('#333');
? ? ? ? ? ? ? ? ?context.setTextAlign('left');
? ? ? ? ? ? ? ? ?context.fillText("跟我一起來學(xué)習(xí)吧~~", 80, 580);
? ? ? ? ? ? ? ? ?context.stroke();
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ?//繪制右下角小程序二維碼
? ? ? ? ? ? ? ? ?context.drawImage(this.erPic.path, 230, 525,70,70);
? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ?context.draw();
? ? ? ? ? ? ? ? ?//將生成好的圖片保存到本地
? ? ? ? ? ? ? ? ?setTimeout(function () {
? ? ? ? ? ? ? ? ? ?uni.canvasToTempFilePath({
? ? ? ? ? ? ? ? ? ? ?canvasId: 'mycanvas',
? ? ? ? ? ? ? ? ? ? ?success: function (res) {
? ? ? ? ? ? ? ? ? ? ? ?var tempFilePath = res.tempFilePath;
?? ??? ??? ??? ??? ? ? that.imagePath = tempFilePath,
?? ??? ??? ??? ??? ? ? that.canvasHidden = true
?? ??? ??? ??? ??? ? ??
?? ??? ??? ??? ??? ? ? ?console.log('將生成好的圖片保存到本地',res,that.imagePath)
?? ??? ??? ??? ??? ? ??
? ? ? ? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ? ? ? ?fail: function (res) {
? ? ? ? ? ? ? ? ? ? ? ?console.log(res);
? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?});
? ? ? ? ? ? ? ? ?}, 200);
? ? ? ? ? ? ? ?},
?? ??? ??? ? ??
?? ??? ??? ? ? //點(diǎn)擊保存到相冊
?? ??? ??? ? ? ? baocun() {
?? ??? ??? ? ? ? ? var that = this
?? ??? ??? ??? ? ? let { imagePath } = this?
?? ??? ??? ??? ? ? console.log('點(diǎn)擊保存到相冊',imagePath)
?? ??? ??? ? ? ? ? uni.saveImageToPhotosAlbum({
?? ??? ??? ? ? ? ? ? filePath: imagePath,
?? ??? ??? ? ? ? ? ? success(res) {
?? ??? ??? ? ? ? ? ? ? uni.showModal({
?? ??? ??? ? ? ? ? ? ? ? content: '海報已保存到相冊',
?? ??? ??? ? ? ? ? ? ? ? showCancel: false,
?? ??? ??? ? ? ? ? ? ? ? confirmText: '確定',
?? ??? ??? ? ? ? ? ? ? ? confirmColor: '#333',
?? ??? ??? ? ? ? ? ? ? ? success: function (res) {
?? ??? ??? ? ? ? ? ? ? ? ? if (res.confirm) {
?? ??? ??? ? ? ? ? ? ? ? ? ? console.log('用戶點(diǎn)擊確定');
?? ??? ??? ? ? ? ? ? ? ? ? ? /* 該隱藏的隱藏 */
?? ??? ??? ??? ??? ??? ??? ? that.maskHidden = false
?? ??? ??? ? ? ? ? ? ? ? ? }
?? ??? ??? ? ? ? ? ? ? ? }, fail: function (res) {
?? ??? ??? ? ? ? ? ? ? ? ? console.log(11111)
?? ??? ??? ? ? ? ? ? ? ? }
?? ??? ??? ? ? ? ? ? ? })
?? ??? ??? ? ? ? ? ? },
?? ??? ??? ??? ??? ? fail() {
?? ??? ??? ??? ??? ? ? ? ?uni.showModal({
?? ??? ??? ??? ??? ? ? ? ? ?title: '提示',
?? ??? ??? ??? ??? ? ? ? ? ?content: '需要您授權(quán)保存相冊',
?? ??? ??? ??? ??? ? ? ? ? ?showCancel: false,
?? ??? ??? ??? ??? ? ? ? ? ?success() {
?? ??? ??? ??? ??? ? ? ? ? ? ?uni.openSetting({
?? ??? ??? ??? ??? ? ? ? ? ? ? ?success(settingdata) {
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?if (settingdata.authSetting['scope.writePhotosAlbum']) { ? ? ? //是否授權(quán)保存到相冊
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?wx.showModal({
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?title: '提示',
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?content: '獲取權(quán)限成功,再次保存圖片即可成功',
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?showCancel: false,
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?})
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?} else {
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?uni.showModal({
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?title: '提示',
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?content: '獲取權(quán)限失敗,無法保存到相冊',
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?showCancel: false,
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?})
?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?}
?? ??? ??? ??? ?
?? ??? ??? ??? ??? ? ? ? ? ? ? ?},
?? ??? ??? ??? ??? ? ? ? ? ? ?})
?? ??? ??? ??? ??? ? ? ? ? ?},
?? ??? ??? ??? ??? ??? ??? ?fail() {
?? ??? ??? ??? ??? ??? ??? ??? ?uni.$u.toast('您已取消')
?? ??? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ? ? ? ?})
?? ??? ??? ??? ??? ? ? ?},
?? ??? ??? ??? ??? ??
?? ??? ??? ? ? ? ? })
?? ??? ??? ? ? ? },
?? ??? ??? ??? ??
?? ??? ??? ??? ? ?//點(diǎn)擊生成
?? ??? ??? ??? ? ? formSubmit: function (e) {
?? ??? ??? ??? ? ? ? var that = this;
?? ??? ??? ??? ??? ? this.maskHidden = false
?? ??? ??? ??? ? ? ? // this.setData({
?? ??? ??? ??? ? ? ? // ? maskHidden: false
?? ??? ??? ??? ? ? ? // });
?? ??? ??? ??? ? ? ? uni.showToast({
?? ??? ??? ??? ? ? ? ? title: '海報生成中...',
?? ??? ??? ??? ? ? ? ? icon: 'loading',
?? ??? ??? ??? ? ? ? ? duration: 1000
?? ??? ??? ??? ? ? ? });
?? ??? ??? ??? ? ? ? setTimeout(function () {
?? ??? ??? ??? ? ? ? ? uni.hideToast()
?? ??? ??? ??? ? ? ? ? that.createNewImg(); ? // 繪圖
?? ??? ??? ??? ??? ? ??
?? ??? ??? ??? ??? ? ? that.maskHidden = true
?? ??? ??? ??? ? ? ? ? // that.setData({
?? ??? ??? ??? ? ? ? ? // ? maskHidden: true
?? ??? ??? ??? ? ? ? ? // });
?? ??? ??? ??? ? ? ? }, 1000)
?? ??? ??? ??? ? ? },
?? ??? ??? ??? ? ??
?? ??? ?},

css樣式:

<style lang="scss">

??
??
.container{
?? ?height: 100vh;
?? ?padding: 10%;
?? ?// background-image: linear-gradient(to bottom right,#F2427B,#EE2847);
?? ?background-color: #DAEDFB;
?? ?
?? ?.bigTitle{
?? ??? ?font-size: 42rpx;
?? ??? ?// color: #FFFFFF;
?? ??? ?padding-bottom: 25rpx;
?? ?}
?? ?.bigTitleTwo{
?? ??? ?font-size: 26rpx;
?? ??? ?// color: #FFFFFF;
?? ??? ?padding-bottom: 25rpx;
?? ?}
?? ?
?? ?.shareBox{
?? ? ? display: flex;
?? ? ? flex-direction: column;
?? ? ? background-color: #fff;
?? ? ??
?? ??? ?.topTime{
?? ??? ??? ?display: flex;
?? ??? ??? ?justify-content: space-between;
?? ??? ??? ?align-items: center;
?? ??? ??? ?padding: 40rpx;
?? ??? ??? ?
?? ??? ??? ?.topItem{
?? ??? ??? ??? ?font-size: 26rpx;
?? ??? ??? ??? ?color: #333;
?? ??? ??? ?}
?? ??? ?}
?? ??? ?
?? ??? ?
?? ??? ?// canvas
?? ??? ?.canvas-box{
?? ??? ??? ?position: fixed;
?? ??? ??? ?opacity: 0;
?? ??? ??? ?bottom: 9999999rpx;
?? ??? ??? ?// ?width: 600rpx;
?? ??? ??? ?// ?height: 860rpx;
?? ??? ??? ?// ?display: flex;
?? ??? ??? ?// ?flex-direction: column;
?? ??? ??? ?// ?align-items: center;
?? ??? ??? ?
?? ??? ??? ?// ?top: 50rpx;
?? ??? ??? ?// ?left: calc(50% - 300rpx);
?? ??? ??? ??
?? ??? ??? ?// canvas{
?? ??? ??? ?// ?? ?width: 100%;
?? ??? ??? ?// ?? ?height: 100%;

?? ??? ??? ?// }
?? ??? ?}
?? ?}
}
?? ?


.bgImg{
? width: 70%;
? height: 440rpx !important;
? margin: 0% 15%;
}
.shareText{
? color: #333;
? font-size: 28rpx;
? display: flex;
? flex-direction: column;
? align-content: center;
? justify-content: center;
? padding: 50rpx 30rpx;
}
.shareText .text{
? // line-height: 60rpx;
? width: 100%;
? box-sizing: border-box;
? display: block;
? color: #333;
}
.shareText .text2{
? text-align: right;
}
.btntxt{
? ?color: #333;
? ? ?font-size: 26rpx;
}
.imgBox{
? text-align: center;
? width: 100%;
? margin-top:20rpx;
? display: flex;
}
.img{
? display: inline-block;
? width: 100%;
? height: 100%;
}
.m_l{
? margin-left: 180rpx;
}
.zfbtn{
? display:flex;
? flex-direction: column;
? font-size: 28rpx;
? align-items: center;
? justify-content: center;
? background: #fff;
}
.zfbtn image{
? width: 70rpx;
? height: 70rpx;
}
button[class="zfbtn"]::after {
? border: 0;
}?
button[class="zfbtn m_l"]::after {
? border: 0;
}?
.imagePathBox{
? width: 100%;
? height: 100%;
? background: rgba(0,0,0,0.7);
? position: fixed;
? top: 0;
? left: 0;
? right: 0;
? bottom: 0;
? z-index: 100000;
}
.shengcheng{
? width: 86%;
? height: 80%;
? position: fixed;
? top: 10%;
? left: 50%;
? margin-left: -43%;
? z-index: 999;
}
.baocun{
? display: block;
? width: 80%;
? height: 75rpx;
? padding: 0;
? line-height: 75rpx;
? text-align: center;
? position: fixed;
? bottom: 50rpx;
? left: 10%;
? color: #fff;
? font-size: 32rpx;
? border-radius: 50rpx;
? background: #fdd668;

}
button[class="baocun"]::after{
? border: 0;
}
</style>
文章來源地址http://www.zghlxwxcb.cn/news/detail-627749.html

到了這里,關(guān)于uniapp微信小程序生成分享海報(模板自取)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 微信小程序 api+前端實(shí)現(xiàn)生成分享海報

    微信小程序 api+前端實(shí)現(xiàn)生成分享海報

    1.先看效果圖,點(diǎn)擊分享海報按鈕,然后彈出分享海報 ?2.前端代碼 這里用的組件有vant組件庫還有canvas_drawer(一個畫布組件) canvas_drawer下載地址 https://github.com/kuckboy1994/mp_canvas_drawer 把 components 中的 canvasdrawer 拷貝到自己項(xiàng)目下,然后再app.json中引用就行了,如下 \\\"usingCompon

    2024年02月09日
    瀏覽(25)
  • 微信小程序生成二維碼海報并分享

    背景:點(diǎn)擊圖標(biāo),生成海報后,點(diǎn)擊保存相冊,可以保存 生成海報:插件wxa-plugin-canvas,此處使用頁面異步生成組件方式,官網(wǎng)地址:wxa-plugin-canvas - npm 二維碼:調(diào)用后端接口生成二維碼 需要調(diào)用獲取圖片信息接口wx.getImageInfo(),獲取到圖片的寬高以做整體寬高配置 closePos

    2024年03月21日
    瀏覽(96)
  • 微信小程序使用canvas生成分享海報功能復(fù)盤

    微信小程序使用canvas生成分享海報功能復(fù)盤

    近期需要開發(fā)一個微信小程序生成海報分享的功能。在h5一般都會直接采用 html2canvas 或者 dom2image 之類的庫直接處理。但是由于小程序不具備傳統(tǒng)意義的dom元素,所以也沒有辦法采用此類工具。 所以就只能一筆一筆的用 canvas 畫出來了,下面對實(shí)現(xiàn)這個功能中遇到的問題做一

    2024年02月16日
    瀏覽(100)
  • 【uniapp】微信小程序 , 海報輪播圖彈窗,點(diǎn)擊海報保存到本地,長按海報圖片分享,收藏或保存
  • 【微信小程序】用painter插件生成海報分享朋友圈簡單教程

    【微信小程序】用painter插件生成海報分享朋友圈簡單教程

    第一步:去Git下載插件 1.這是核心插件 需要下載全部內(nèi)容 2.官方文檔 3.新建painter文件夾放到下面 4.在引用文件的json文件引用一下 5.在使用文件里創(chuàng)建個canvas.js文件 獲取canvas.js內(nèi)容去這個網(wǎng)站 先點(diǎn)擊導(dǎo)出,在點(diǎn)擊復(fù)制,復(fù)制到canvas.js文件里(替換) 6.然后在對應(yīng)page頁面的

    2024年02月10日
    瀏覽(105)
  • 微信小程序使用canvas畫布生成二維碼海報分享圖片(完整示例代碼)

    微信小程序使用canvas畫布生成二維碼海報分享圖片(完整示例代碼)

    canvas.js //獲取應(yīng)用實(shí)例 const app = getApp() Page({ /** 頁面的初始數(shù)據(jù) */ data: { // canvas _width: 0, //手機(jī)屏寬 _heigth: 0,//手機(jī)屏高 swiperHeight: 300,//主圖圖片高度 canvasType: false,//canvas是否顯示 loadImagePath: ‘’,//下載的圖片 imageUrl: ‘https://cos.myfaka.com/car/service/1.jpg’, //主圖網(wǎng)絡(luò)路徑 codeU

    2024年04月12日
    瀏覽(103)
  • 微信小程序canvas type=2d生成海報保存到相冊、文字換行溢出顯示...、文字刪除線、分享面板

    微信小程序canvas type=2d生成海報保存到相冊、文字換行溢出顯示...、文字刪除線、分享面板

    做個簡單的生成二維碼海報分享, 我做的時候也找簡單的方法看能不能實(shí)現(xiàn)頁面直接截圖那種生成圖片,原生小程序不支持, 不多介紹下面有全部代碼有注釋、參數(shù)自行替換運(yùn)行看看,還有需要優(yōu)化的地方,有問題可以咨詢我,我寫的已經(jīng)上線 如圖:

    2024年02月11日
    瀏覽(94)
  • uniapp 實(shí)現(xiàn)生成海報并分享給微信好友和保存到本地相冊

    uniapp 實(shí)現(xiàn)生成海報并分享給微信好友和保存到本地相冊

    – 最近又遇到一個需求:用戶需要將小程序生成的二維碼海報分享給微信好友或者保存到本地,最后實(shí)現(xiàn)的效果如下: 這種網(wǎng)上隨便找一下就有了,樓主采用的是tki-qrcode 生成二維碼組件,具體的鏈接如下: 鏈接: https://blog.csdn.net/qq_45829293/article/details/123169952 因?yàn)榭紤]到到時

    2023年04月09日
    瀏覽(97)
  • uniapp開發(fā)微信小程序生成二維碼海報

    uniapp開發(fā)微信小程序生成二維碼海報

    模板:

    2024年02月12日
    瀏覽(27)
  • 微信小程序之海報生成

    微信小程序之海報生成

    前言:2.9.0 起支持一套新 Canvas 2D 接口(需指定 type 屬性),同時支持同層渲染,原有接口不再維護(hù) 參考文檔:https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html ? ?

    2024年02月11日
    瀏覽(26)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包