| | |
| | | <u-avatar src="/static/images/logo.png" size="70" /> |
| | | </view> |
| | | <view class="flex-1"> |
| | | <view class="pb-20rpx text-36rpx"> |
| | | uni-app |
| | | </view> |
| | | <view class="pb-20rpx text-36rpx"> uni-app </view> |
| | | <view class="u-tips-color text-28rpx" @click="toCopy"> |
| | | 微信号:uni-app |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { useClipboard, usePermission } from "@/hooks" |
| | | import { useClipboard, usePermission } from "@/hooks"; |
| | | |
| | | const { setClipboardData, getClipboardData } = useClipboard() |
| | | const { setClipboardData, getClipboardData } = useClipboard(); |
| | | |
| | | // 复制 |
| | | const toCopy = async () => { |
| | | await setClipboardData({ data: "1234567890" }) |
| | | const data = await getClipboardData() |
| | | console.log("[ data ] >", data) |
| | | } |
| | | await setClipboardData({ data: "1234567890" }); |
| | | const data = await getClipboardData(); |
| | | console.log("[ data ] >", data); |
| | | }; |
| | | |
| | | // 登录鉴权,微信小程序端点击tabbar的底层逻辑不触发uni.switchTab,需要在页面onShow生命周期中校验权限 |
| | | onShow(async () => { |
| | | const hasPermission = await usePermission() |
| | | console.log(hasPermission ? "已登录" : "未登录,拦截跳转") |
| | | }) |
| | | |
| | | const hasPermission = await usePermission(); |
| | | console.log(hasPermission ? "已登录" : "未登录,拦截跳转"); |
| | | }); |
| | | </script> |