Skip to content

Commit 0df1414

Browse files
authored
Merge pull request #10 from danvincent11/master
feat: toast notification
2 parents daee1a3 + e2829e7 commit 0df1414

6 files changed

+46
-2
lines changed

nuxt.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default {
8282
// Doc: https://axios.nuxtjs.org/usage
8383
'@nuxtjs/axios',
8484
'@nuxtjs/pwa',
85+
'vue-toastification/nuxt',
8586
],
8687
/**
8788
* Public runtime configs
@@ -105,6 +106,23 @@ export default {
105106
},
106107
},
107108
},
109+
toast: {
110+
transition: 'Vue-Toastification__fade',
111+
maxToasts: 20,
112+
newestOnTop: true,
113+
position: 'bottom-left',
114+
timeout: 5000,
115+
closeOnClick: true,
116+
pauseOnFocusLoss: true,
117+
pauseOnHover: true,
118+
draggable: false,
119+
draggablePercent: 0.6,
120+
showCloseButtonOnHover: true,
121+
hideProgressBar: true,
122+
closeButton: 'button',
123+
icon: true,
124+
rtl: false,
125+
},
108126
/**
109127
* PWA module configuration
110128
* https://pwa.nuxtjs.org/setup.html

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"babel-core": "^7.0.0-bridge.0",
3333
"nuxt": "^2.15.4",
3434
"nuxt-property-decorator": "^2.7.2",
35-
"regenerator-runtime": "^0.13.7"
35+
"regenerator-runtime": "^0.13.7",
36+
"vue-toastification": "^1.7.14"
3637
},
3738
"devDependencies": {
3839
"@nuxt/types": "^2.13.0",

pages/index.vue

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ export default class Index extends Vue {
9696
9797
// print values using runtime config
9898
console.log('APP_NAME', this.$config.appName)
99+
100+
// Toast notification
101+
this.$toast.info('Hello')
99102
}
100103
}
101104
</script>

tsconfig.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
"~/*": ["./*"],
1616
"@/*": ["./*"]
1717
},
18-
"types": ["@types/node", "@nuxt/types", "@nuxtjs/axios", "jest"]
18+
"types": [
19+
"@types/node",
20+
"@nuxt/types",
21+
"@nuxtjs/axios",
22+
"jest",
23+
"vue-toastification/nuxt"
24+
]
1925
},
2026
"exclude": ["node_modules", ".nuxt", "dist"]
2127
}

types/vue-shims-tsx.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Vue, { VNode } from 'vue'
2+
3+
declare global {
4+
namespace JSX {
5+
type Element = VNode
6+
type ElementClass = Vue
7+
interface IntrinsicElements {
8+
[elem: string]: any
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)