优化细节

This commit is contained in:
icssoa
2025-11-03 00:11:22 +08:00
parent 0f77ebef71
commit c9d38852e9
4 changed files with 46 additions and 33 deletions

View File

@@ -21,14 +21,17 @@
</template>
<script lang="ts" setup>
// #ifdef APP
import { shareWithSystem } from "@/uni_modules/cool-share";
// #endif
import DemoItem from "../components/item.uvue";
import { t } from "@/locale";
function shareText() {
// #ifdef APP
shareWithSystem({
type: "text",
title: "Cool Unix 是一个高效的项目脚手架",
title: "Cool Unix",
summary: "Cool Unix 是一个高效的项目脚手架",
success: () => {
console.log("success");
@@ -37,9 +40,11 @@ function shareText() {
console.log("fail", error);
}
});
// #endif
}
function shareImage() {
// #ifdef APP
shareWithSystem({
type: "image",
url: "https://cool-js.com/logo.png",
@@ -47,9 +52,11 @@ function shareImage() {
console.log("success");
}
});
// #endif
}
function shareFile() {
// #ifdef APP
shareWithSystem({
type: "file",
url: "https://show.cool-admin.com/用户导入模版.xlsx",
@@ -57,9 +64,11 @@ function shareFile() {
console.log("success");
}
});
// #endif
}
function shareLink() {
// #ifdef APP
shareWithSystem({
type: "link",
url: "https://cool-js.com/",
@@ -67,6 +76,7 @@ function shareLink() {
console.log("success");
}
});
// #endif
}
</script>

View File

@@ -52,22 +52,24 @@
<view class="list">
<cl-row :gutter="10">
<cl-col :span="6" v-for="child in item.children" :key="child.label">
<view
class="item dark:!bg-surface-800"
hover-class="opacity-80"
:hover-stay-time="250"
@tap="toPath(child)"
>
<cl-icon :name="child.icon" :size="36"></cl-icon>
<cl-text
:pt="{
className: 'mt-1 !text-xs text-center'
}"
>{{ child.label }}</cl-text
<template v-for="child in item.children" :key="child.label">
<cl-col :span="6" v-if="child.hidden != true">
<view
class="item dark:!bg-surface-800"
hover-class="opacity-80"
:hover-stay-time="250"
@tap="toPath(child)"
>
</view>
</cl-col>
<cl-icon :name="child.icon" :size="36"></cl-icon>
<cl-text
:pt="{
className: 'mt-1 !text-xs text-center'
}"
>{{ child.label }}</cl-text
>
</view>
</cl-col>
</template>
</cl-row>
</view>
</view>
@@ -85,7 +87,7 @@
</template>
<script lang="ts" setup>
import { isMp, router, useRefs } from "@/cool";
import { isApp, isMp, router, useRefs } from "@/cool";
import { t } from "@/locale";
import { computed } from "vue";
import { useUi } from "@/uni_modules/cool-ui";
@@ -102,6 +104,7 @@ type Item = {
icon?: string;
path?: string;
disabled?: boolean;
hidden?: boolean;
children?: Item[];
};
@@ -475,7 +478,8 @@ const data = computed<Item[]>(() => {
{
label: "Share",
icon: "share-line",
path: "/pages/demo/other/share"
path: "/pages/demo/other/share",
hidden: !isApp()
}
]
}

View File

@@ -4,17 +4,16 @@
>Apple/苹果 iPhone 15 (A3092) 128GB 黑色 支持移动联通电信5G 双卡双待手机</cl-text
>
<view class="flex flex-row items-center mb-3 overflow-visible">
<view class="flex flex-row items-end overflow-visible">
<view class="flex flex-row items-center mb-3">
<view class="flex flex-row items-end">
<cl-text color="error" :pt="{ className: 'font-bold text-sm' }">¥</cl-text>
<cl-text
type="amount"
:value="8499"
color="error"
:size="44"
currency=""
:pt="{
className: 'font-bold ml-1'
className: 'font-bold ml-1 text-2xl'
}"
>
</cl-text>