共计 701 个字符,预计需要花费 2 分钟才能阅读完成。
uniapp 分享提示 share 方法不存在
错误代码
<view class="text-lg flex flex-col mt-4">
<view class="flex mt-4">
<u-button type="primary" @click="wxLogin"> 免费注册使用 </u-button>
</view>
<view class="mt-4 pb-10">
<u-button type="primary" @click="shareUrl"> 分享给好友 </u-button>
</view>
</view>
const shareUrl = () => {
// #ifdef MP-WEIXIN
uni.share({
provider: 'weixin',
type: 0,
href: '<https://www.asds.com>',
title: '能写作',
summary: '一文案',
imageUrl: '<https://www.doasdsa.com/static/images/icon/logo.png>'
})
// #endif
}
正确需要添加 open-type=”share”
<view class="text-lg flex flex-col mt-4">
<view class="flex mt-4">
<u-button type="primary" @click="wxLogin"> 免费注册使用 </u-button>
</view>
<view class="mt-4 pb-10">
<u-button type="primary" open-type="share" @click="shareUrl"> 分享给好友 </u-button>
</view>
</view>
正文完