4.0.1 • Published 5 years ago

vuejs-snackbar v4.0.1

Weekly downloads
172
License
MIT
Repository
github
Last release
5 years ago

vuejs-snackbar

NPM Version Download Month gzip with dependencies: 1.3kb pkg.module

pkg.module supported, which means that you can apply tree-shaking in you project

A Vuejs snackbar component, supported SSR, compatible with IE

Repository: https://github.com/livelybone/vuejs-snackbar.git

You can rewrite all style by set prop wrapClass. the css file content maybe like:

  .[wrapClass] {
    ...
    
    .snack-bar {
      ...
    }
  }

Demo

https://livelybone.github.io/vue/vuejs-snackbar/

Installation

npm install vuejs-snackbar --save-dev

Register the component

import Snackbar from 'vuejs-snackbar';

// Global register
Vue.component('snackbar', Snackbar);

// Local register
new Vue({
  components:{Snackbar}
})

Apply

// template
<template>
    <snackbar ref="snackbar" baseSize="100px" :wrapClass="''" :colors="null" :holdTime="3000" :multiple="true"/>
</template>
// component
export default{
  name:'AnyComponent',
  mounted(){
    this.$refs.snackbar.info('msg');
    this.$refs.snackbar.error('msg');
    this.$refs.snackbar.warn('msg');
    this.$refs.snackbar.open('msg');
  },
  components:{Snackbar}  // Local register
}

Props

NameTypeDefaultValueDescription
baseSizeString100pxUsed to set size of snackbar. Tested by reg: /\d(rem|px|em)$/
wrapClassStringnoneUsed to set the wrap class of snackbar. When it Used, the prop 'baseSize' will be ignored, and you must rewrite all the style of snackbar
colorsObject{open: '#333',info: '#3DBD7D',error: '#FA7377',warn: '#FF6600'}Used to set the background color of snackbar with different type
holdTimeNumber3000Used to set hold time of snackbar
multipleBooleantrueUsed to set if it show multiple snackbar or not
positionStringtop-centerUsed to set the position of the wrap

method

NameParameter
openmsg --> String, Object. when it is an Object, it must be an Object with property toStringFunction], or with property messageString.
infomsg
warnmsg
errormsg
4.0.1

5 years ago

4.0.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

6 years ago

3.0.0-beta0

6 years ago

2.8.0

6 years ago

2.7.0

6 years ago

2.6.4

6 years ago

2.6.3

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.0

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago