0.0.8 • Published 5 years ago

vue2-alert v0.0.8

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

Vue2Alert

Vue Component for Vue 2.x

Install

    npm install vue2-alert --save

Demo

For demo, please see here

Usage

1. Import the component

import Vue2Alert from 'vue2-alert';

2.1 Use it globally

Vue.use(Vue2Alert);

// OR with options

Vue.use(Vue2Alert, {baseURL: 'https://jsonplaceholder.typicode.com/', headers: {'X-API-KEY': 1234}});

*3. Access it locally

<template>
    <vue2-alert ref="http" v-model="data" :error-fn="onError"></vue2-alert>
</template>
components: {
    'vue2-alert': Vue2Alert
},

Properties

  • msg: String

  • icon: String

  • html: Boolean

  • error: Boolean

  • hideAfter: Number

  • customClass: String

  • canClose: Boolean (default: 1)

Example

<template>
    <div id="app">
        <div>
            <vue2-alert :msg="msg" :hide-after="2000" :error="true" custom-class="alert-info"></vue2-alert>

            <button class="btn btn-primary btn-sm" type="button" @click="msg += ' this is a test'">Test</button>

            {{msg}}

        </div>
    </div>
</template>

<script>
    import Vue from 'vue';
    import Vue2Alert from '../src/index'

    Vue.use(Vue2Alert, {});

    export default {
        name: 'app',
        data() {
            return {
                msg: 'hello!'
            }
        },
        methods: {
            test() {
                // code
            }
        },
    }
</script>

Contributing

Contributions are welcome

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build
0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

1.0.1

7 years ago