vue2-alert
v0.0.8
Published
Vue2Alert: Http component with Progress bar
Downloads
21
Maintainers
Readme
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