0.0.4 • Published 2 years ago

@myu68/toast-designer v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

A Simple Popup Tip Component for Vue.js

npm version

Installation

npm i @myu68/toast-designer

Usage

In main.js of a Vue Project:

import toast from '@myu/toast-designer';
Vue.use(toast);

In any Vue component, you can simply use this.$toast() to popup a tip:

<script>
export default {
  mounted() {
    this.$toast({
      type: 'success',
      msg: 'Fight!'
    });
  }
}
</script>

Options and Defaults

type

string
Default value is success.
Type of toast, could be one of these values: success | warning | danger | loading.

msg

string
The info you want to show on the toast. (should be short)

duration

number
Default value is 3.
How many seconds he toast should be shown, after that it could disapear automaticly.
Specially, you can set a value of -1, which means showing the toast forever.

position

string
Default value is top-center.
Position of toast, could be one of these values: top-left | top-center | top-right | bottom-left | bottom-center | bottom-right | center-center.

fullWith

boolean
Default value is false.
Determines the toast appears in a full-with way or not.

Example

this.$toast({
  type: 'warning',
  msg: 'Caution!',
  duration: 6,
  position: 'top-center',
  fullWith: false
});

Notice

peerDependencies 中的包在生成 umd 文件时不会被打包进去,以免和引入此插件的项目中 vue 版本冲突
npm publish 发布 npm 包,需修改 package.json 中的 version,递增 1
git commit
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago