添加 cool-share 插件

This commit is contained in:
icssoa
2025-10-30 19:28:09 +08:00
parent 85d5b4d562
commit 629d402a88
15 changed files with 980 additions and 4 deletions

View File

@@ -0,0 +1,73 @@
<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>

View File

@@ -471,6 +471,11 @@ const data = computed<Item[]>(() => {
label: "Router",
icon: "compass-discover-line",
path: "/pages/demo/other/router/index"
},
{
label: "Share",
icon: "share-line",
path: "/pages/demo/other/share"
}
]
}