vue-notifications
Version:
Vuejs notifications
369 lines (166 loc) • 11.4 kB
HTML
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Introduction and WTF is it? · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="installation.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter active" data-level="1.1" data-path="./">
<a href="./">
Introduction and WTF is it?
</a>
</li>
<li class="chapter " data-level="1.2" data-path="installation.html">
<a href="installation.html">
Installation
</a>
</li>
<li class="chapter " data-level="1.3" data-path="getting-started.html">
<a href="getting-started.html">
Getting Started
</a>
</li>
<li class="chapter " data-level="1.4" data-path="usage.html">
<a href="usage.html">
Usage
</a>
</li>
<li class="chapter " data-level="1.5" data-path="what-you-shouldnt-do.html">
<a href="what-you-shouldnt-do.html">
What you shouldn't do
</a>
</li>
<li class="chapter " data-level="1.6" data-path="advanced-setup.html">
<a href="advanced-setup.html">
Advanced Setup
</a>
</li>
<li class="chapter " data-level="1.7" data-path="how-it-works.html">
<a href="how-it-works.html">
How it works
</a>
</li>
<li class="chapter " data-level="1.8" data-path="browsers-support.html">
<a href="browsers-support.html">
Browsers support
</a>
</li>
<li class="chapter " data-level="1.9" data-path="vuejs-versions-support.html">
<a href="vuejs-versions-support.html">
Vuejs Versions Support
</a>
</li>
<li class="chapter " data-level="1.10" >
<a target="_blank" href="https://github.com/se-panfilov/vue-notifications/releases">
Release Notes
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >Introduction and WTF is it?</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="introduction-and-wtf-is-it">Introduction and WTF is it?</h1>
<p><code>vue-notifications</code> is "Vue.js agnostic non-blocking notifications library"... and it's a lie )) Seriously.</p>
<p><code>vue-notifications</code>it's basically <strong>a bridge</strong> between your actual app and UI-notfications libs, like <a href="https://github.com/se-panfilov/mini-toastr" target="_blank">mini-toastr</a>.</p>
<h3 id="why-do-we-need-this">Why do we need this?</h3>
<p>Because we want to have a way to show notifications and a way to easy replace UI library that show them without rewrite the code.</p>
<h3 id="what-vue-notifications-actually-do">What <code>vue-notifications</code> actually do?</h3>
<p>It's allow you to declare your notifications in blocks like this one:</p>
<pre><code class="lang-js"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
name: <span class="hljs-string">'DemoView'</span>,
data () {
<span class="hljs-comment">//...</span>
},
methods: {
<span class="hljs-comment">//...</span>
},
notifications: {
showLoginError: { <span class="hljs-comment">// You can have any name you want instead of 'showLoginError'</span>
title: <span class="hljs-string">'Login Failed'</span>,
message: <span class="hljs-string">'Failed to authenticate'</span>,
type: <span class="hljs-string">'error'</span> <span class="hljs-comment">// You also can use 'VueNotifications.types.error' instead of 'error'</span>
}
}
}
</code></pre>
<p>And then call it via <code>this</code>: <code>this.showLoginError()</code>, and also with some override props: <code>this.showLoginError({message: 'whatever'})</code>.</p>
<h3 id="why-do-we-need-third-party-ui-lib-like-mini-toastr">Why do we need third-party UI lib (like <a href="https://github.com/se-panfilov/mini-toastr" target="_blank">mini-toastr</a>)?</h3>
<p>Well, because we want to be agnostic.
That's mean that if at some step you would be fucked up with your UI library, <code>vue-notifications</code> will allow you to replace it as much easy as possible. Basically you would be required to replace <code>vue-notifications</code>'s config. And that's all.</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="installation.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Installation">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Introduction and WTF is it?","level":"1.1","depth":1,"next":{"title":"Installation","level":"1.2","depth":1,"path":"installation.md","ref":"installation.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"README.md","mtime":"2019-05-08T14:09:27.851Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-08-01T12:24:20.020Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>