钟铮锁App web部分 需要打包放进对应的安卓项目 生成apk 才能正常使用功能
he wei
2025-01-19 ba2cfa9907623c094e6e2d52d12dc3055ddd587a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { ref, reactive } from "vue";
import {ElMessageBox, ElMessage, ElLoading} from 'element-plus';
 
// Toast
import { Toast } from 'vant';
import 'vant/es/toast/style';
 
// Dialog
import { Dialog } from 'vant';
import 'vant/es/dialog/style';
 
// Notify
import { Notify } from 'vant';
import 'vant/es/notify/style';
 
// ImagePreview
import { ImagePreview } from 'vant';
import 'vant/es/image-preview/style';
 
export default () => {
  const $message = ElMessage;
 
  function $confirm(operate, fnOk, fnCancel = () => {}) {
    
    ElMessageBox.confirm(
      `请确认是否${operate}?`,
      '系统提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true,
      }
    )
      .then(() => {
       fnOk();
      })
      .catch(() => {
        fnCancel();
      })
  }
 
  function $loading(customOptions = {}) {
    const defaultOptions = {
      lock: true,
      text: "Loading",
      background: "rgba(0, 0, 0, 0.7)",
      target: document.body,
      // 可以添加更多默认配置
    };
  
    // 合并默认配置和自定义配置
    const options = { ...defaultOptions, ...customOptions };
  
    // 调用Element UI的加载服务
    const loadingInstance = ElLoading.service(options);
    return loadingInstance;
    // return () => {
    //   console.log('?', 'close', '=============');
      
    //   loadingInstance.close();
    // };
  }
 
  function $toast(str) {
    Toast(str);
  }
 
 
  return { $confirm, $message, $loading, $toast, Toast };
};