Skip to content

Commit 75861db

Browse files
committed
update readme
1 parent 1cc73b3 commit 75861db

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
}
1919

2020
// eslint-disable-next-line no-unused-vars
21-
Vue.prototype.$notification = (title, body, dateTime, icon = null, handleClick) => {
21+
Vue.prototype.$notification = (title, body, dateTime, icon = null, handleClick = null) => {
2222
vm.addNewNotification(Math.random(), title, body, dateTime, icon, handleClick)
2323
}
2424
}

package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"name": "vue-notification-ui",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Vue Notification UI",
55
"main": "src/notification.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
9-
"keywords": [],
10-
"author": "",
9+
"keywords": ["vuejs", "plugins", "notification", "toastr", "notification-ui"],
10+
"author": "HEL Mab",
1111
"license": "ISC",
1212
"dependencies": {
1313
"vuex": "^3.5.1"
14-
}
14+
},
15+
"repository": {
16+
"type" : "git",
17+
"url" : "git+https://github.com/HELMAB/vue-notification-ui.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/HELMAB/vue-notification-ui/issues"
21+
},
22+
"homepage": "https://github.com/HELMAB/vue-notification-ui#README"
1523
}

src/Notification.vue

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div :class="`notification ${options.position}`">
2+
<div :class="`notification ${options.position}`"
3+
:style="classPosition">
34
<NotificationItem
45
:callback="handleClicked"
56
:key="key"
@@ -20,19 +21,42 @@ export default {
2021
return {
2122
options: {
2223
position: 'notification-top-right',
23-
duration: 2500
24+
duration: 2500,
25+
top: 20,
26+
bottom: 20,
27+
left: 20,
28+
right: 40,
2429
},
2530
handleClick: null,
2631
}
2732
},
2833
computed: {
2934
...mapState({
3035
notifications: state => state.notification.notifications
31-
})
36+
}),
37+
classPosition() {
38+
let styles = ''
39+
const positions = this.options.position.split('-')
40+
if (positions[1] === 'top') {
41+
styles += `top: ${this.options.top}px;`
42+
} else {
43+
styles += `bottom: ${this.options. bottom}px;`
44+
}
45+
46+
if (positions[2] === 'left') {
47+
styles += `left: ${this.options.left}px;`
48+
} else {
49+
styles += `right: ${this.options.right}px;`
50+
}
51+
52+
return styles
53+
}
3254
},
3355
methods: {
34-
handleClicked () {
35-
this.handleClick()
56+
handleClicked() {
57+
if (this.handleClick) {
58+
this.handleClick()
59+
}
3660
},
3761
addNewNotification(id, title, body, dateTime, icon, handleClick) {
3862
this.handleClick = handleClick

src/components/NotificationItem.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<template>
2-
<div class="notification-item" @click="handleClick">
2+
<div class="notification-item">
33
<div class="notification-icon"
4+
@click="handleClick"
45
:class="{'no-circle' : notification.icon === null}"
56
:style="`background-image: url(${icon});`">
67
</div>
7-
<div class="notification-content">
8+
<div class="notification-content" @click="handleClick">
89
<div class="notification-title">
910
<div class="notification-title-text">
1011
<h3 v-html="notification.title"></h3>

0 commit comments

Comments
 (0)