Files
code/src/composables/notice.ts
yuetsh fb071e71a1 fix: 修复分享链接的多个问题
- reset() 清空时一并剥离 share 参数,否则重载后分享代码会被写回
- share() 以去掉 query/share 的地址为基址,避免预设代码在 init 里覆盖分享内容
- 打开分享链接前比对本地已存代码,会覆盖用户改动时先弹窗确认
- SQL 分享带上选中的数据表 id,接收方运行结果与分享者一致
- 分享负载的 code/table 字段补类型校验
- 链接损坏或预设加载失败时给出提示,不再静默吞掉
- 剪贴板写入失败时不再提示"已复制"

组件外的 init 阶段拿不到 useMessage(),新增 composables/notice.ts
用 createDiscreteApi 提供提示与确认框,主题跟随 useDark()。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CWT2cy7mkZevZR4WVVfAVu
2026-09-07 04:08:54 -06:00

16 lines
474 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useDark } from "@vueuse/core"
import { createDiscreteApi, darkTheme } from "naive-ui"
import { computed } from "vue"
const isDark = useDark()
// 组件外(如 init 阶段)需要提示时用这套脱离上下文的 API主题跟随 App.vue
const api = createDiscreteApi(["message", "dialog"], {
configProviderProps: computed(() => ({
theme: isDark.value ? darkTheme : null,
})),
})
export const notice = api.message
export const dialog = api.dialog