vue-notifications
Version:
Vuejs notifications
390 lines (185 loc) • 11.3 kB
HTML
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>What you shouldn't do · 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="advanced-setup.html" />
<link rel="prev" href="usage.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 " 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 active" 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="." >What you shouldn't do</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="what-you-shouldt-do">What you should't do</h1>
<p>As I told you in <a href="usage.html">Usage</a> section - there is no difference between methods defined in <code>notifications: {...}</code> section and methods defined in <code>methods: {...}</code>section.</p>
<p>That's also mean you can't have two methods with same names in those sections, cause they will overlaps.</p>
<p>So, <strong>BAD</strong>:</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: {
showLoginError () { <span class="hljs-comment">//Same name!!!</span>
<span class="hljs-comment">//...</span>
}
},
notifications: {
showLoginError: { <span class="hljs-comment">//Same name!!!</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>
}
}
}
</code></pre>
<p><strong>GOOD</strong>:</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: {
loginError () {
<span class="hljs-comment">//... this.showLoginError() // or whatever</span>
}
},
notifications: {
showLoginError: {
title: <span class="hljs-string">'Login Failed'</span>,
message: <span class="hljs-string">'Failed to authenticate'</span>,
type: <span class="hljs-string">'error'</span>
}
}
}
</code></pre>
</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="usage.html" class="navigation navigation-prev " aria-label="Previous page: Usage">
<i class="fa fa-angle-left"></i>
</a>
<a href="advanced-setup.html" class="navigation navigation-next " aria-label="Next page: Advanced Setup">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"What you shouldn't do","level":"1.5","depth":1,"next":{"title":"Advanced Setup","level":"1.6","depth":1,"path":"advanced-setup.md","ref":"advanced-setup.md","articles":[]},"previous":{"title":"Usage","level":"1.4","depth":1,"path":"usage.md","ref":"usage.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":"what-you-shouldnt-do.md","mtime":"2019-05-08T14:09:27.877Z","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>