Code Monkey home page Code Monkey logo

x5-notify's Introduction

x5 Notify (Live Demo)

npm bundle size

This is a lightweight notice plugin.

⚠️ This plugin is in development, so please let me know if you find any errors.

Notices

Installation

# npm
npm install x5-notify

Deployment

This plugin does require a Vuex store and can be installed like any Vue plugin in your entry point:

Vue.use(Vuex)
const store = new Vuex.Store()

import x5Notify from 'x5-notify'
Vue.use(x5Notify, store)

new Vue({
  el: '#app',
  store: store,
  render: (h) => h(App),
})

This plugin uses a component to house all the magic, so it's recommended to put this near the end of your Vue app (e.g. bottom of your App.vue template)

<div id="app">
  ...
  <x5-notify></x5-notify>
</div>
Attribute Type Default Description
position String bottom-right Origin of notices - see options below*
zIndex Number 200 z-index style for plugin
max Number 5 Limit number of open notices (use 0 to remove limit)**

:info: * Positions options: top-left, top-center, top-right, center-left, center-center, center-right, bottom-left, bottom-center, bottom-right

⚠️ ** onClose() callbacks disabled for notices exceeding notice limit.

⚠️ This plugin is not transpiled! If you want to include it for use on IE or Edge, you need to add this to your vue.config.js file:

module.exports = {
  transpileDependencies: ['x5-notify']
}

Usage

Quick Method - this.$notify(type, text)

this.$notify('success', 'This is a success notice')

Full Method: this.$notify(options)

this.$notify({ type: 'success', text: 'This is a success notice', wait: 5 })
Options Type Default Description
type String default One of success, warning, error, info, special, default
text String -- Notice text (required) - can be HTML
onClose Function -- Callback for when the notice is closed
onClick Function -- Callback for clicking on the notice
onClickText String "(click to dismiss)" Description of click action (bottom right hand corner)
wait Number 5 Time in seconds before notice is destroyed
closeOnClick Boolean true Closes the notice early if clicked


Contributing

Please read CONTRIBUTING.md for the process for submitting pull requests.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgements

Inspired by:

x5-notify's People

Contributors

dependabot[bot] avatar xon52 avatar

Stargazers

 avatar

Watchers

 avatar

x5-notify's Issues

Cannot compile/run after installing

Hello, I’ve been progressing with my app…specifically using the ‘modals’ to hold a somewhat complex ‘form’ component. All is working fine with it – very nice job. That said, I would like to integrate x5-Notify into the page. I used npm to install the package from github… then ‘registered’ the package as instructed. However, when I try to run (simply ‘compiling/navigating to home page’) I get an error (and the site thus will not load):

index.js:1 Uncaught TypeError: t.registerModule is not a function
    at t.default (index.js:1)
    at Function.Vue.use (vue.runtime.esm.js:5109)
    at Module../src/main.js (main.js:34)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object.1 (app.js:10635)
    at __webpack_require__ (bootstrap:784)
    at checkDeferredModules (bootstrap:45)
    at bootstrap:860
    at bootstrap:860

I’m guessing this is coming from your index.js file where you try to:
store.registerModule(‘x5/n’, PluginStore)

Here is the pertinent stuff from my code:

From main.js:

At very top:

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/store'
….
import x5Modal from 'x5-modal'
import x5Notify from 'x5-notify'

…mid-way down:
Vue.use(x5Modal, x5Notify, store)

From App.vue, near end of ‘template’ markup:

    <x5-modals></x5-modals>
    <x5-notify></x5-notify>
  </v-app>
</template>

from package.json, within ‘dependencies’:

"x5-modal": "^0.2.12",
"x5-notify": "^0.3.7"

Nothing is jumping out at me... thoughts?

-David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.