| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <cl-page>
- <view class="p-3">
- <demo-item :label="t('分享文本')">
- <cl-button @tap="shareText">{{ t("分享文本") }}</cl-button>
- </demo-item>
- <demo-item :label="t('分享图片')">
- <cl-button @tap="shareImage">{{ t("分享图片") }}</cl-button>
- </demo-item>
- <demo-item :label="t('分享文件')">
- <cl-button @tap="shareFile">{{ t("分享文件") }}</cl-button>
- </demo-item>
- <demo-item :label="t('分享链接')">
- <cl-button @tap="shareLink">{{ t("分享链接") }}</cl-button>
- </demo-item>
- </view>
- </cl-page>
- </template>
- <script lang="ts" setup>
- import { shareWithSystem } from "@/uni_modules/cool-share";
- import DemoItem from "../components/item.uvue";
- import { t } from "@/locale";
- function shareText() {
- shareWithSystem({
- type: "text",
- title: "Cool Unix 是一个高效的项目脚手架",
- summary: "",
- success: () => {
- console.log("success");
- },
- fail: (error) => {
- console.log("fail", error);
- }
- });
- }
- function shareImage() {
- shareWithSystem({
- type: "image",
- imageUrl: "https://cool-js.com/logo.png",
- success: () => {
- console.log("success");
- }
- });
- }
- function shareFile() {
- shareWithSystem({
- type: "file",
- href: "https://show.cool-admin.com/用户导入模版.xlsx",
- success: () => {
- console.log("success");
- }
- });
- }
- function shareLink() {
- shareWithSystem({
- type: "link",
- href: "https://cool-js.com/",
- success: () => {
- console.log("success");
- }
- });
- }
- </script>
- <style lang="scss" scoped></style>
|