vue-coe-feedback

vue-coe-feedback ✅
1,394 4
Install
npm install vue-coe-feedback
Latest Version:0.1.5
Vue:2
License:MIT
Last Updated:Dec 9, 2022
Links: GitHub  ·  npm
Maintainer: viniazvd

vue-coe-feedback ✅

License


✨ Example✨


Install
yarn add vue-coe-feedback or npm i add vue-coe-feedback

Configuration

import Vue from 'vue'

import { VueCoeFeedback } from 'vue-coe-feedback'

Vue.use(VueCoeFeedback, store, options)

how to use?

  • inside the component:
this.$feedback.add({ type, message, highlighted })
or
this.$feedback.remove({ type, message, highlighted })
  • inside the store:
actions: {
  SOME_ACTION: ({ commit, dispatch }) => {
    ...
    dispatch('FEEDBACKS_ADD', { type, message, highlighted })
    or
    dispatch('FEEDBACKS_REMOVE', { type, message, highlighted })
    ...
  }
}

options type

  • info
  • success
  • error

Example

<template>
  <div id="app">
    <coe-feedback @close="feedback => $feedback.remove(feedback)" :feedbacks="$feedback.list" />

    <button @click="onSucces">show feedback success</button>
    <button @click="onInfo">show feedback info</button>
    <button @click="onError">show feedback error</button>

    <button @click="onCoe">set coe</button>
  </div>
</template>

<script>
import { CoeFeedback } from 'vue-coe-feedback'

export default {
  components: { CoeFeedback },
  
  methods: {
    onSucces () {
      this.$feedback.add({ type: 'success', message: 'A sua compra foi', highlighted: 'aprovada!' })
    },

    onInfo () {
      this.$feedback.add({ type: 'info', message: 'INFO' })
    },

    onError () {
      this.$feedback.add({ type: 'error', message: 'ERROR' })
    },

    onCoe () {
      this.$store.dispatch('COE', { type: 'success', message: 'COÉ MANÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ!' })
    }
  }
}
...
</script>

Options: plugin instance

Name Default Required About
storeName coefeedback false store name
delay 5000 false delay for notifications to disappear

component props

Name Default Required About
feedbacks [] false list of feedbacks
info #b4b4b4 false info color
success #59efb2 false success color
error #ef5959 false error color

Events

  • close

Slots: component

  • feedbacks (slot-scope: feedback, info, success, error)
  • message
  • button

Inspired by @VitorLuizC idea.

Related Packages

@voerro/vue-notifications

Easily display notifications to your users

6,096 1
vue-notifikation

vue plugin for notifications

1,663 7
vue-dk-toast

Lightweight toast notification plugin for Vue 3

28,320 26
@gianrase/vue3-notifications

Easy-configurable Vue3 notifications system.

1,709 0

Version History

Version Released Vue License
0.1.5 ^2.5.16 MIT
0.1.4 ^2.5.16 MIT
0.1.3 ^2.5.16 MIT
0.1.2 ^2.5.16 MIT
0.1.1 ^2.5.16 MIT