1.3.3 • Published 4 years ago

vue3-xyh-dialog v1.3.3

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

推荐使用proste-loadingproste-dialog,使用typescript重写,更好的类型推导和使用hook方式使用

基于Vue3的loading和toast插件

css 动画样式使用的 vivify 动画组件中的部分动画

从npm下载插件

npm install vue3-xyh-dialog

loading

在 main.js 进行引入并初始化

import {loading, dialog} from 'vue3-xyh-dialog';

createApp(App)
  .use(loading)
  .mount('#app')

xyhLoading(type, msg);

ParamTypeDescription
typeBoolean是否展示
msgStringloading 提示语句

示例

import { inject, onMounted } from "vue";

export default {
  name: "App",
  setup() {
    const loading = inject("xyhLoading");

    onMounted(() => {
      loading(true, "正在加载");
      setTimeout(() => loading(false), 2000);
    });
  },
};

avatar

dialog

在 main.js 进行引入并初始化

import {loading, dialog} from 'vue3-xyh-dialog';

createApp(App)
  .use(dialog, {theme: '#d84315', color: 'white'})
  .mount('#app')

options

ParamTypeDescription
themeString确认按钮背景色
colorString文字颜色

xyhToast(options)

ParamTypeDescription
durationNumber展示时间,字段为0时展示按钮组
typeNumber0:成功,1:警告,2:错误
titleString标题
contentString内容
confirmTextString确认按钮内容
showCancelBoolean展示取消按钮
cancelTextString取消按钮内容
callbackresFunctionBoolean回调方法,返回点击按钮,确认按钮返回true,取消按钮返回false

示例

import { inject, onMounted } from "vue";

export default {
  name: "App",
  setup() {
    const dialog = inject("xyhDialog");

    onMounted(() => {
      const options = {
        type: 1,
        content: "您确定要删除当前元素吗?",
        confirmText: "确定",
        showCancel: true,
        cancelText: "取消",
        callback: (res) => console.log(res),
      };
      dialog(options);
    });
  },
};

avatar

出现问题欢迎反馈至https://github.com/xyhxx/Vue3Plugins,谢谢! vue2版本地址https://github.com/xyhxx/toast

1.3.3

4 years ago

1.3.2

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago