0.3.0 • Published 6 years ago

muse-ui-toast v0.3.0

Weekly downloads
82
License
MIT
Repository
github
Last release
6 years ago

Muse-UI-Toast

Muse-UI plugin toast

Installation

npm install muse-ui-toast -S
// or
yarn add muse-ui-toast

CDN

<link rel="stylesheet" href="https://unpkg.com/muse-ui-loading/dist/muse-ui-toast.all.css"/>
<script src="https://unpkg.com/muse-ui-toast/dist/muse-ui-toast.js"></script>

Usage

import Vue from 'vue'
import MuseUIToast from 'muse-ui-toast';

Vue.use(MuseUIToast);

new Vue({
  methods: {
    toast () {
      this.$toast.message('hello world');
      this.$toast.success('hello world');
      this.$toast.info('hello world');
      this.$toast.warning('hello world');
      this.$toast.error('hello world');
    }
  }
});

// Or
MuseUIToast.message('hello world');
MuseUIToast.success('hello world');
MuseUIToast.info('hello world');
MuseUIToast.warning('hello world');
MuseUIToast.error('hello world');

API

config

Vue.use(MuseUIToast, config) change default config

export default {
  position: 'bottom',               // position
  time: 2000,                       // show time length
  closeIcon: 'close',               // close icon
  close: true,                      // show close button
  successIcon: 'check_circle',      // success icon
  infoIcon: 'info',                 // info icon
  warningIcon: 'priority_high',     // warning icon
  errorIcon: 'warning'              // error icon
};

config (config)

Change default config, Will return new config;

message(options<String/Object>)

Show default message, Will return id;

success(options<String/Object>)

Show default success message, Will return id;

info(options<String/Object>)

Show default info message, Will return id;

error(options<String/Object>)

Show default error message, Will return id;

warning(options<String/Object>)

Show default warning message, Will return id;

options

NameDescriptionTypeAccepted ValuesDefault
messageshow message contentString
timeshow time lengthNumber2000
positionshow positionStringtop / top-start / top-end / bottom / bottom-start / bottom-endbottom
closeWhether the show close buttonBooleantrue
iconleft iconString
actionsaction buttons,Array, { action: '', click: (id) => {} }
colorcolorString
textColormessage text colorString

close (id)

close message

Dependencies Muse-UI Components

  • mu-snackbar
  • mu-button
  • mu-icon

Licence

muse-ui-toast is open source and released under the MIT Licence.

Copyright (c) 2018 myron

0.3.0

6 years ago

0.2.1

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago