Skip to content

Commit 9c85fc4

Browse files
authored
Merge pull request #4 from vuejs/master
Sync branch english-version
2 parents 0db530c + 93eefd3 commit 9c85fc4

23 files changed

+299
-341
lines changed

src/images/logo-vuemastery.svg

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/v2/api/index.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ type: api
509509

510510
A list/hash of attributes that are exposed to accept data from the parent component. It has an Array-based simple syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values.
511511

512+
With Object-based syntax, you can use following options:
513+
- **type:** can be one of the following native constructors: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, any custom constructor function or an array of those. Will check if a prop has a given type, and will throw a warning if it doesn't. [More information](../guide/components-props.html#Prop-Types) on prop types.
514+
- **default:** `any`
515+
Specifies a default value for the prop. If the prop is not passed, this value will be used instead. Object or array defaults must be returned from a factory function.
516+
- **required:** `Boolean`
517+
Defines if the prop is required. In a non-production environment, a console warning will be thrown if this value is truthy and the prop is not passed.
518+
- **validator:** `Function`
519+
Custom validator function that takes the prop value as the sole argument. In a non-production environment, a console warning will be thrown if this function returns a falsy value (i.e. the validation fails). You can read more about prop validation [here](../guide/components-props.html#Prop-Validation).
520+
512521
- **Example:**
513522

514523
``` js
@@ -535,7 +544,7 @@ type: api
535544
})
536545
```
537546

538-
- **See also:** [Props](../guide/components.html#Props)
547+
- **See also:** [Props](../guide/components-props.html)
539548

540549
### propsData
541550

src/v2/cookbook/serverless-blog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ created() {
298298

299299
## Alternative Patterns
300300

301-
An alternative pattern to consider, especially if you prefer writing only in Markdown, is using something like [Nuxtent](https://nuxtent.now.sh/guide/writing#async-components). Nuxtent allows you to use `Vue Component` inside of Markdown files. This approach would be akin to a static site approach (i.e. Jekyll) where you compose your blog posts in Markdown files. Nuxtent adds a nice integration between Vue.js and Markdown allowing you to live in a 100% Vue.js world.
301+
An alternative pattern to consider, especially if you prefer writing only in Markdown, is using something like [Nuxtent](https://nuxtent-module.netlify.com/guide/writing/#async-components). Nuxtent allows you to use `Vue Component` inside of Markdown files. This approach would be akin to a static site approach (i.e. Jekyll) where you compose your blog posts in Markdown files. Nuxtent adds a nice integration between Vue.js and Markdown allowing you to live in a 100% Vue.js world.
302302

303303
## Wrap up
304304

src/v2/examples/themes.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: Themes
3+
type: examples
4+
is_new: true
5+
order: 13
6+
---
7+
> With the examples below built by our partners from [Creative Tim](https://creative-tim.com?affiliate_id=116187) you can see how a real world application is built, the technology stack behind it and how most of the concepts you've learned so far apply in a real world application.
8+
9+
{% raw %}
10+
<div id="themes-example" class="themes-grid">
11+
<div v-for="product in products" :key="product.name" class="item-preview">
12+
<a class="item-preview-img" :href="`https://www.creative-tim.com/product/${product.name}?affiliate_id=${affiliateId}`" rel="nofollow">
13+
<img :src="`https://raw.githubusercontent.com/creativetimofficial/public-assets/master/${product.name}/${product.name}.jpg`" :alt="`${product.title} - ${product.description}`"></a>
14+
<div class="item-preview-title-container">
15+
<h3 :id="product.name" data-type="theme-product-title" class="item-preview-title" :class="{'free': product.free}">{{product.title}}</h3>
16+
<b v-if="product.price" class="item-preview-price">{{product.price}}$</b>
17+
</div>
18+
<div class="item-preview-description">{{product.description}}</div>
19+
</div>
20+
<div class="see-more-container">
21+
<a :href="`https://www.creative-tim.com/bootstrap-themes/vuejs-themes?affiliate_id=${affiliateId}`"
22+
class="button white see-more-link">
23+
See More Themes
24+
</a>
25+
</div>
26+
</div>
27+
<script>
28+
new Vue({
29+
el: '#themes-example',
30+
data: {
31+
affiliateId: 116187,
32+
products: [
33+
{
34+
name: 'vue-argon-design-system',
35+
title: 'Vue Argon Design System',
36+
free: true,
37+
description: 'Free Vue.js Design System'
38+
},
39+
{
40+
name: 'vue-black-dashboard-pro',
41+
title: 'Vue Black Dashboard Pro',
42+
free: false,
43+
price: 59,
44+
description: 'Premium Vue.js Admin Template'
45+
},
46+
{
47+
name: 'vue-paper-dashboard-2-pro',
48+
title: 'Vue Paper Dashboard 2 Pro',
49+
free: false,
50+
price: 59,
51+
description: 'Premium Vue.js Admin Template'
52+
},
53+
{
54+
name: 'vue-material-kit',
55+
title: 'Vue Material Kit',
56+
free: true,
57+
description: 'Free Vue.js UI Kit'
58+
},
59+
{
60+
name: 'vue-black-dashboard',
61+
title: 'Vue Black Dashboard',
62+
free: true,
63+
description: 'Free Vue.js Admin Template'
64+
},
65+
{
66+
name: 'vue-now-ui-kit-pro',
67+
title: 'Vue Now UI Kit Pro',
68+
free: false,
69+
price: 79,
70+
description: 'Premium Vue.js UI Kit'
71+
},
72+
{
73+
name: 'vue-now-ui-dashboard-pro',
74+
title: 'Vue Now UI Dashboard Pro',
75+
free: false,
76+
price: 59,
77+
description: 'Premium Vue.js Admin Template'
78+
},
79+
{
80+
name: 'vue-now-ui-kit',
81+
title: 'Vue Now UI Kit',
82+
free: true,
83+
description: 'Free Vue.js UI Kit'
84+
},
85+
{
86+
name: 'vue-light-bootstrap-dashboard-pro',
87+
title: 'Vue Light Bootstrap Dashboard Pro',
88+
free: false,
89+
price: 49,
90+
description: 'Premium Vue.js Admin Template'
91+
},
92+
{
93+
name: 'vue-material-dashboard-pro',
94+
title: 'Vue Material Dashboard Pro',
95+
free: false,
96+
price: 59,
97+
description: 'Premium Vue.js Admin Template'
98+
},
99+
{
100+
name: 'vue-material-kit-pro',
101+
title: 'Vue Material Kit Pro',
102+
free: false,
103+
price: 89,
104+
description: 'Premium Vue.js UI Kit'
105+
},
106+
{
107+
name: 'vue-light-bootstrap-dashboard',
108+
title: 'Vue Light Bootstrap Dashboard',
109+
free: true,
110+
description: 'Free Vue.js Admin Template'
111+
}
112+
]
113+
}
114+
})
115+
</script>
116+
{% endraw %}

src/v2/guide/components-props.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ props: {
4141
likes: Number,
4242
isPublished: Boolean,
4343
commentIds: Array,
44-
author: Object
44+
author: Object,
45+
callback: Function,
46+
contactsPromise: Promise // or any other constructor
4547
}
4648
```
4749

src/v2/guide/components-registration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,15 @@ requireComponent.keys().forEach(fileName => {
207207
// Get PascalCase name of component
208208
const componentName = upperFirst(
209209
camelCase(
210-
// Strip the leading `./` and extension from the filename
211-
fileName.replace(/^\.\/(.*)\.\w+$/, '$1')
210+
// Gets the file name regardless of folder depth
211+
fileName
212+
.split('/')
213+
.pop()
214+
.replace(/\.\w+$/, '')
212215
)
213216
)
214217

218+
215219
// Register component globally
216220
Vue.component(
217221
componentName,

src/v2/guide/components-slots.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,15 @@ That means the value of `v-slot` can actually accept any valid JavaScript expres
332332
This can make the template much cleaner, especially when the slot provides many props. It also opens other possibilities, such as renaming props, e.g. `user` to `person`:
333333

334334
``` html
335-
<current-user v-slot="{ user: person }">>
335+
<current-user v-slot="{ user: person }">
336336
{{ person.firstName }}
337337
</current-user>
338338
```
339339

340340
You can even define fallbacks, to be used in case a slot prop is undefined:
341341

342342
``` html
343-
<current-user v-slot="{ user = { firstName: 'Guest' } }">>
343+
<current-user v-slot="{ user = { firstName: 'Guest' } }">
344344
{{ user.firstName }}
345345
</current-user>
346346
```

src/v2/guide/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ You may have noticed that Vue components are very similar to **Custom Elements**
393393

394394
2. Vue components provide important features that are not available in plain custom elements, most notably cross-component data flow, custom event communication and build tool integrations.
395395

396+
Although Vue doesn't use custom elements internally, it has [great interoperability](https://custom-elements-everywhere.com/#vue) when it comes to consuming or distributing as custom elements. Vue CLI also supports building Vue components that register themselves as native custom elements.
397+
396398
## Ready for More?
397399

398400
We've briefly introduced the most basic features of Vue.js core - the rest of this guide will cover them and other advanced features with much finer details, so make sure to read through it all!

src/v2/guide/instance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ new Vue({
142142

143143
There are also other hooks which will be called at different stages of the instance's lifecycle, such as [`mounted`](../api/#mounted), [`updated`](../api/#updated), and [`destroyed`](../api/#destroyed). All lifecycle hooks are called with their `this` context pointing to the Vue instance invoking it.
144144

145-
<p class="tip">Don't use [arrow functions](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions) on an options property or callback, such as `created: () => console.log(this.a)` or `vm.$watch('a', newValue => this.myMethod())`. Since arrow functions are bound to the parent context, `this` will not be the Vue instance as you'd expect, often resulting in errors such as `Uncaught TypeError: Cannot read property of undefined` or `Uncaught TypeError: this.myMethod is not a function`.</p>
145+
<p class="tip">Don't use [arrow functions](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions) on an options property or callback, such as `created: () => console.log(this.a)` or `vm.$watch('a', newValue => this.myMethod())`. Since an arrow function doesn't have a `this`, `this` will be treated as any other variable and lexically looked up through parent scopes until found, often resulting in errors such as `Uncaught TypeError: Cannot read property of undefined` or `Uncaught TypeError: this.myMethod is not a function`.</p>
146146

147147
## Lifecycle Diagram
148148

src/v2/guide/list.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ Similar to template `v-if`, you can also use a `<template>` tag with `v-for` to
441441

442442
## `v-for` with `v-if`
443443

444+
<p class="tip">Note that it's **not** recommended to use `v-if` and `v-for` together. Refer to [style guide](/v2/style-guide/#Avoid-v-if-with-v-for-essential) for details.</p>
445+
444446
When they exist on the same node, `v-for` has a higher priority than `v-if`. That means the `v-if` will be run on each iteration of the loop separately. This can be useful when you want to render nodes for only _some_ items, like below:
445447

446448
``` html

src/v2/guide/syntax.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Dynamic arguments are expected to evaluate to a string, with the exception of `n
154154

155155
#### Dynamic Argument Expression Constraints
156156

157-
<p class="tip">Dynamic argument expressions have some syntax constraints because certain characters are invalid inside HTML attribute names, such as spaces and quotes.</p>
157+
<p class="tip">Dynamic argument expressions have some syntax constraints because certain characters are invalid inside HTML attribute names, such as spaces and quotes. You also need to avoid uppercase keys when using in-DOM templates.</p>
158158

159159
For example, the following is invalid:
160160

@@ -165,6 +165,13 @@ For example, the following is invalid:
165165

166166
The workaround is to either use expressions without spaces or quotes, or replace the complex expression with a computed property.
167167

168+
In addition, if you are using in-DOM templates (templates directly written in an HTML file), you have to be aware that browsers will coerce attribute names into lowercase:
169+
170+
``` html
171+
<!-- This will be converted to v-bind:[someattr] in in-DOM templates. -->
172+
<a v-bind:[someAttr]="value"> ... </a>
173+
```
174+
168175
### Modifiers
169176

170177
Modifiers are special postfixes denoted by a dot, which indicate that a directive should be bound in some special way. For example, the `.prevent` modifier tells the `v-on` directive to call `event.preventDefault()` on the triggered event:

src/v2/guide/team.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ order: 803
764764
{
765765
name: 'James McGlasson',
766766
title: 'Head of Marketing Communications',
767-
imageUrl: 'https://media.licdn.com/dms/image/C4E03AQHxi_fy33l5Mg/profile-displayphoto-shrink_800_800/0?e=1550707200&v=beta&t=6kPVnuYMxbxR_oAz3rdAeuDB-S8Om8e5W3zwbcH0dQI',
767+
imageUrl: 'https://media.licdn.com/dms/image/C4E03AQHxi_fy33l5Mg/profile-displayphoto-shrink_800_800/0?e=1556150400&v=beta&t=KADJ_7nuWuYFPQaKtK7QuI96iC0gPKc198GZ-_dXr_0',
768768
city: 'Amsterdam, Netherlands',
769769
languages: ['en', 'nl', 'de'],
770770
work: {
@@ -797,9 +797,13 @@ order: 803
797797
title: 'Fox Tech Guru',
798798
city: 'Kyiv, Ukraine',
799799
languages: ['uk', 'ru', 'en'],
800+
reposOfficial: [
801+
'vuejs.org'
802+
],
800803
work: {
801-
role: 'CTO',
802-
org: 'Vue Vixens',
804+
role: 'Senior Frontend Engineer',
805+
org: 'GitLab',
806+
orgUrl: 'https://gitlab.com/'
803807
},
804808
github: 'NataliaTepluhina',
805809
twitter: 'N_Tepluhina',

themes/vue/_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ gold_sponsors:
7272
- url: 'https://webdock.io/en'
7373
img: webdock.png
7474
name: Webdock
75-
- url: 'https://syncfusion.com/products/vue'
75+
- url: >-
76+
http://www.syncfusion.com/?utm_source=vuejs&utm_medium=list&utm_campaign=vuejsjslistcy19
7677
img: syncfusion.png
7778
name: SyncFusion
7879
- url: 'https://opteo.com/vue'

themes/vue/layout/layout.ejs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/72160148.js"></script>
7979
</head>
8080
<body class="<%- isIndex ? '' : 'docs' -%>">
81-
<%- partial('partials/vuemastery_banner.ejs') %>
8281
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>
8382
<a class="menu-button"></a>
8483
<a class="logo" href="/"></a>

0 commit comments

Comments
 (0)