1.0.2 • Published 5 years ago

proste-dialog v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

中文文档 | Englist

基于Vue3的dialog插件

proste: 波兰语,简单的,实在找不到什么好玩的单词了,本来想用tiga(迪迦奥特曼),但是感觉太中二了...

初始化插件能力

ParamTypeDescription
theme?String确认按钮颜色
color?String按钮字体颜色
<template>
  <HelloWorld />
</template>

<script lang="ts">
import HelloWorld from './components/HelloWorld.vue';

import {provideDialog} from 'proste-dialog';

export default ({
  name: 'App',
  components: {
    HelloWorld,
  },
  setup() {
    // 提供dialog—hook能力
    provideDialog({color: 'white', theme: 'red'});
  },
});
</script>

继承使用hook能力

ParamTypeDescription
typeNumber0:成功,1:警告,2:错误
duration?Number展示时间,字段为0时展示按钮组
title?String标题
contentString内容
confirmText?String确认按钮内容
showCancel?Boolean展示取消按钮
cancelText?String取消按钮内容
callback?(res: Boolean) => void回调方法,返回点击按钮,确认按钮返回true,取消按钮返回false
<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>

import {useDialog} from '../plugin/proste-dialog/dist';

export default {
  name: 'HelloWorld',
  setup() {
    // 继承使用hook
    const dialog = useDialog();
    dialog({
      type: 1,
      content: '询问内容',
      confirmText: '确定',
      showCancel: true,
      cancelText: '关闭',
      callback: res => console.log(res),
    });
  },
};
</script>

avatar

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago