Skip to content

Commit 6bc5cbe

Browse files
committed
Site updated: 2016-10-02 17:24:24
1 parent fdb754a commit 6bc5cbe

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

api/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,7 @@ <h3 id="filters"><a href="#filters" class="headerlink" title="filters"></a>filte
583583
</li>
584584
<li><p><strong>See also:</strong></p>
585585
<ul>
586-
<li><a href="/guide/custom-filter.html">Custom Filters</a></li>
587-
<li><a href="/guide/components.html#Assets-Naming-Convention">Assets Naming Convention</a></li>
586+
<li><a href="#Vue-filter"><code>Vue.filter</code></a></li>
588587
</ul>
589588
</li>
590589
</ul>

css/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ a.button.white {
505505
display: none;
506506
padding-left: 0;
507507
}
508-
@media screen and (max-width: 720px) {
508+
@media screen and (max-width: 900px) {
509509
.sidebar {
510510
position: fixed;
511511
z-index: 8;

css/page.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ ul.demo li {
608608
display: none;
609609
padding-left: 0;
610610
}
611-
@media screen and (max-width: 720px) {
611+
@media screen and (max-width: 900px) {
612612
.sidebar {
613613
position: fixed;
614614
z-index: 8;
@@ -802,7 +802,7 @@ ul.demo li {
802802
left: 140px;
803803
}
804804
}
805-
@media screen and (max-width: 720px) {
805+
@media screen and (max-width: 900px) {
806806
#ad {
807807
width: 100%;
808808
}
@@ -833,7 +833,7 @@ ul.demo li {
833833
padding: 1.2em 1em;
834834
}
835835
.content.with-sidebar {
836-
margin-left: 0;
836+
margin: auto;
837837
}
838838
.footer {
839839
margin-left: 0;

guide/installation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ <h3 id="Standalone-vs-Runtime-only-Build"><a href="#Standalone-vs-Runtime-only-B
390390
<p class="tip">Do NOT do <code>import Vue from &#39;vue/dist/vue.js&#39;</code> - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.</p>
391391

392392
<h3 id="CSP-environments"><a href="#CSP-environments" class="headerlink" title="CSP environments"></a>CSP environments</h3><p>Some environments, such as Google Chrome Apps, enforce Content Security Policy (CSP), which prohibits the use of <code>new Function()</code> for evaluating expressions. The standalone build depends on this feature to compile templates, so is unusable in these environments.</p>
393-
<p>On the other hand, the runtime-only build is fully CSP-compliant. When using the runtime-only build with <a href="https://github.com/vuejs-templates/webpack-simple-2.0" target="_blank" rel="external">Webpack + vue-loader</a> or <a href="https://github.com/vuejs-templates/browserify-simple-2.0" target="_blank" rel="external">Browserify + vueify</a>, your templates will be precompiled into <code>render</code> functions which work perfectly in CSP environments.</p>
393+
<p>On the other hand, the runtime-only build is fully CSP-compliant. When using the runtime-only build with <a href="https://github.com/vuejs-templates/webpack-simple" target="_blank" rel="external">Webpack + vue-loader</a> or <a href="https://github.com/vuejs-templates/browserify-simple" target="_blank" rel="external">Browserify + vueify</a>, your templates will be precompiled into <code>render</code> functions which work perfectly in CSP environments.</p>
394394
<h2 id="CLI"><a href="#CLI" class="headerlink" title="CLI"></a>CLI</h2><p>Vue.js provides an <a href="https://github.com/vuejs/vue-cli" target="_blank" rel="external">official CLI</a> for quickly scaffolding ambitious Single Page Applications. It provides batteries-included build setups for a modern frontend workflow. It takes only a few minutes to get up and running with hot-reload, lint-on-save, and production-ready builds:</p>
395395
<figure class="highlight bash"><table><tr><td class="code"><pre><div class="line"><span class="comment"># install vue-cli</span></div><div class="line">$ npm install --global vue-cli</div><div class="line"><span class="comment"># create a new project using the "webpack" template</span></div><div class="line">$ vue init webpack my-project</div><div class="line"><span class="comment"># install dependencies and go!</span></div><div class="line">$ <span class="built_in">cd</span> my-project</div><div class="line">$ npm install</div><div class="line">$ npm run dev</div></pre></td></tr></table></figure>
396396
<h2 id="Dev-Build"><a href="#Dev-Build" class="headerlink" title="Dev Build"></a>Dev Build</h2><p><strong>Important</strong>: the built files in GitHub’s <code>/dist</code> folder are only checked-in during releases. To use Vue from the latest source code on GitHub, you will have to build it yourself!</p>

guide/migration.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ <h4 id="Replacing-the-capitalize-Filter"><a href="#Replacing-the-capitalize-Filt
810810
<h4 id="Replacing-the-uppercase-Filter"><a href="#Replacing-the-uppercase-Filter" class="headerlink" title="Replacing the uppercase Filter"></a>Replacing the <code>uppercase</code> Filter</h4><figure class="highlight js"><table><tr><td class="code"><pre><div class="line">text.toUpperCase()</div></pre></td></tr></table></figure>
811811
<h4 id="Replacing-the-lowercase-Filter"><a href="#Replacing-the-lowercase-Filter" class="headerlink" title="Replacing the lowercase Filter"></a>Replacing the <code>lowercase</code> Filter</h4><figure class="highlight js"><table><tr><td class="code"><pre><div class="line">text.toLowerCase()</div></pre></td></tr></table></figure>
812812
<h4 id="Replacing-the-pluralize-Filter"><a href="#Replacing-the-pluralize-Filter" class="headerlink" title="Replacing the pluralize Filter"></a>Replacing the <code>pluralize</code> Filter</h4><p>The <a href="https://www.npmjs.com/package/pluralize" target="_blank" rel="external">pluralize</a> package on NPM serves this purpose nicely, but if you only want to pluralize a specific word or want to have special output for cases like <code>0</code>, then you can also easily define your own pluralize functions. For example:</p>
813-
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">pluralizeKnife</span> (<span class="params">count</span>) </span>&#123;</div><div class="line"> <span class="keyword">if</span> (count === <span class="number">0</span>) &#123;</div><div class="line"> <span class="keyword">return</span> <span class="string">'no knives'</span></div><div class="line"> &#125; <span class="keyword">else</span> <span class="keyword">if</span> (count === <span class="number">1</span>) &#123;</div><div class="line"> <span class="keyword">return</span> count + <span class="string">'knife'</span></div><div class="line"> &#125; <span class="keyword">else</span> &#123;</div><div class="line"> <span class="keyword">return</span> count + <span class="string">'knives'</span></div><div class="line"> &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
813+
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">pluralizeKnife</span> (<span class="params">count</span>) </span>&#123;</div><div class="line"> <span class="keyword">if</span> (count === <span class="number">0</span>) &#123;</div><div class="line"> <span class="keyword">return</span> <span class="string">'no knives'</span></div><div class="line"> &#125; <span class="keyword">else</span> <span class="keyword">if</span> (count === <span class="number">1</span>) &#123;</div><div class="line"> <span class="keyword">return</span> <span class="string">'1 knife'</span></div><div class="line"> &#125; <span class="keyword">else</span> &#123;</div><div class="line"> <span class="keyword">return</span> count + <span class="string">'knives'</span></div><div class="line"> &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
814814
<h4 id="Replacing-the-currency-Filter"><a href="#Replacing-the-currency-Filter" class="headerlink" title="Replacing the currency Filter"></a>Replacing the <code>currency</code> Filter</h4><p>For a very naive implementation, you could just do something like this:</p>
815815
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line"><span class="string">'$'</span> + price.toFixed(<span class="number">2</span>)</div></pre></td></tr></table></figure>
816816
<p>In many cases though, you’ll still run into strange behavior (e.g. <code>0.035.toFixed(2)</code> rounds up to <code>0.4</code>, but <code>0.045</code> rounds down to <code>0.4</code>). To work around these issues, you can use the <a href="http://openexchangerates.github.io/accounting.js/" target="_blank" rel="external"><code>accounting</code></a> library to more reliably format currencies.</p>

guide/ssr.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ <h2 id="Simple-SSR-with-the-Express-Web-Server"><a href="#Simple-SSR-with-the-Ex
401401
<p>As long as the referenced <code>assets</code> directory contains the <code>app.js</code> file we created earlier, as well as a <code>vue.js</code> file with Vue, we should now have a working single-page application!</p>
402402
<p>Then to get it working with server-side rendering, there’s just one more step - the web server:</p>
403403
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line"><span class="comment">// server.js</span></div><div class="line"><span class="meta">'use strict'</span></div><div class="line"></div><div class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</div><div class="line"><span class="keyword">var</span> path = <span class="built_in">require</span>(<span class="string">'path'</span>)</div><div class="line"></div><div class="line"><span class="comment">// Define global Vue for server-side app.js</span></div><div class="line">global.Vue = <span class="built_in">require</span>(<span class="string">'vue'</span>)</div><div class="line"></div><div class="line"><span class="comment">// Get the HTML layout</span></div><div class="line"><span class="keyword">var</span> layout = fs.readFileSync(<span class="string">'./index.html'</span>, <span class="string">'utf8'</span>)</div><div class="line"></div><div class="line"><span class="comment">// Create a renderer</span></div><div class="line"><span class="keyword">var</span> renderer = <span class="built_in">require</span>(<span class="string">'vue-server-renderer'</span>).createRenderer()</div><div class="line"></div><div class="line"><span class="comment">// Create an express server</span></div><div class="line"><span class="keyword">var</span> express = <span class="built_in">require</span>(<span class="string">'express'</span>)</div><div class="line"><span class="keyword">var</span> server = express()</div><div class="line"></div><div class="line"><span class="comment">// Serve files from the assets directory</span></div><div class="line">server.use(<span class="string">'/assets'</span>, express.static(</div><div class="line"> path.resolve(__dirname, <span class="string">'assets'</span>)</div><div class="line">))</div><div class="line"></div><div class="line"><span class="comment">// Handle all GET requests</span></div><div class="line">server.get(<span class="string">'*'</span>, <span class="function"><span class="keyword">function</span> (<span class="params">request, response</span>) </span>&#123;</div><div class="line"> <span class="comment">// Render our Vue app to a string</span></div><div class="line"> renderer.renderToString(</div><div class="line"> <span class="comment">// Create an app instance</span></div><div class="line"> <span class="built_in">require</span>(<span class="string">'./assets/app'</span>)(),</div><div class="line"> <span class="comment">// Handle the rendered result</span></div><div class="line"> <span class="function"><span class="keyword">function</span> (<span class="params">error, html</span>) </span>&#123;</div><div class="line"> <span class="comment">// If an error occurred while rendering...</span></div><div class="line"> <span class="keyword">if</span> (error) &#123;</div><div class="line"> <span class="comment">// Log the error in the console</span></div><div class="line"> <span class="built_in">console</span>.error(error)</div><div class="line"> <span class="comment">// Tell the client something went wrong</span></div><div class="line"> <span class="keyword">return</span> response</div><div class="line"> .status(<span class="number">500</span>)</div><div class="line"> .send(<span class="string">'Server Error'</span>)</div><div class="line"> &#125;</div><div class="line"> <span class="comment">// Send the layout with the rendered app's HTML</span></div><div class="line"> response.send(layout.replace(<span class="string">'&lt;div id="app"&gt;&lt;/div&gt;'</span>, html))</div><div class="line"> &#125;</div><div class="line"> )</div><div class="line">&#125;)</div><div class="line"></div><div class="line"><span class="comment">// Listen on port 5000</span></div><div class="line">server.listen(<span class="number">5000</span>, <span class="function"><span class="keyword">function</span> (<span class="params">error</span>) </span>&#123;</div><div class="line"> <span class="keyword">if</span> (error) <span class="keyword">throw</span> error</div><div class="line"> <span class="built_in">console</span>.log(<span class="string">'Server is running at localhost:5000'</span>)</div><div class="line">&#125;)</div></pre></td></tr></table></figure>
404-
<p>And that’s it! Here’s <a href="https://github.com/chrisvfritz/vue-ssr-demo-simple" target="_blank" rel="external">the full application</a>, in case you’d like to clone it and experiment further. Once you have it running locally, you can confirm that server-side rendering really is working by right-clickig on the page and selecting <code>View Page Source</code> (or similar). You should see this in the body:</p>
404+
<p>And that’s it! Here’s <a href="https://github.com/chrisvfritz/vue-ssr-demo-simple" target="_blank" rel="external">the full application</a>, in case you’d like to clone it and experiment further. Once you have it running locally, you can confirm that server-side rendering really is working by right-clicking on the page and selecting <code>View Page Source</code> (or similar). You should see this in the body:</p>
405405
<figure class="highlight html"><table><tr><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span> <span class="attr">server-rendered</span>=<span class="string">"true"</span>&gt;</span>You have been here for 0 seconds&amp;period;<span class="tag">&lt;/<span class="name">div</span>&gt;</span></div></pre></td></tr></table></figure>
406406
<p>instead of:</p>
407407
<figure class="highlight html"><table><tr><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></div></pre></td></tr></table></figure>

0 commit comments

Comments
 (0)