shuishen
2025-10-11 3fc27febccd04e2fcffbd2cdd16d2daafd0b3ca3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * Dialog 提示框
 * @example
 * const {showModal} = useModal()
 * showModal('提示内容')
 */
export default function useModal () {
  const showModal = (content, options) => {
    return new Promise((resolve, reject) => {
      uni.showModal({
        title: "温馨提示",
        content,
        showCancel: false,
        confirmColor: "#1677FF",
        success: res => resolve(res),
        fail: () => reject(new Error("Alert 调用失败 !")),
        ...options
      })
    })
  }
  return {
    showModal
  }
}