Skip to content

Commit a73823d

Browse files
committed
0.10
1 parent 6ffcaee commit a73823d

File tree

6 files changed

+90
-58
lines changed

6 files changed

+90
-58
lines changed

source/_drafts/why-vuejs.md

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

source/_posts/vuejs-010-release.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
title: Vue.js 0.10 is here!
2+
date: 2014-03-22 19:00:13
3+
type: '{{type}}'
4+
---
5+
6+
Vue.js 0.10.0 (Blade Runner) has been released! This release comes with many useful additions based on the suggestions from the users, notably interpolation in literal directives, dynamic components with the new `v-view` directive, array filters, and the option to configure interpolation delimiters. Internally, the codebase has received many refactoring and inprovements which makes Vue.js even faster.
7+
8+
<!-- more -->
9+
10+
See the [Installation](/guide/installation.html) page for the latest builds.
11+
12+
### New
13+
14+
- Literal directives can now contain interpolation tags. These tags will be evaluated only once at compile time. An example usage is conditionally decide which component to instantiate with `v-component="{{type}}"`. [Doc](/guide/directives.html#literal-directives).
15+
- Attributes listed in the `paramAttributes` option now accept mustache interpolations too. They will also only be evaluated once.
16+
- `v-repeat` now accepts an argument which will be used as the identifier for the wrapped object. This allows more explicit property access in repeaters. [Doc](/guide/list.html#using-an-identifier).
17+
- Added `v-view` directive which binds to a string value and dynamically instantiate different components using that string as the component ID. [Doc](/api/directives.html#v-view).
18+
- Added `filterBy` and `orderBy` filters for `v-repeat`. [Doc](/api/filters.html#filterby).
19+
- Custom filters that access properties on its `this` context will be considered **computed filters**. [Doc](/guide/filters.html#computed-filters).
20+
- You can now access the event in `v-on` handler expressions as `$event`. Example: `<a v-on="click:handle('hello', $event)">Hello</a>`
21+
- Interpolation delimiters can now be customized via the `delimiters` global config option. Example: `Vue.config({ delimiters: ["[", "]"] })` will change the matched interpolation tags to `[[ ]]` for text bindings and `[[[ ]]]` for html bindings.
22+
23+
### Changed
24+
25+
- To use a component as a custom element, the component ID must now contain a hyphen (`-`). This is consistent with the current custom element spec draft.
26+
- `v-repeat` Arrays' augmented methods have been renamed to `$set(index, value)` and `$remove(index | value)` to better differentiate from native methods. The `replace` method has been removed.
27+
- When iterating over an Object with `v-repeat`, the object no longer gets a `$repeater` array. Instead, the object is now augmented with two methods: `$add(key, value)` and `$delete(key)`, which will trigger corresponding view updates.
28+
- Production build now strips all warnings and debug logs. To leverage `debug: true` you now have to use the development version.
29+
- `v-if` now creates and destroys a child ViewModel instance when the binding value changes, instead of simply removing/inserting the DOM node. In addition, it can no longer be used with `v-repeat`. Use `v-show` or the new built-in array filters instead.
30+
- `v-with` can no longer be used alone. It now must be used with either `v-component` or `v-view`. `v-component` can also be used as an empty directive just to create a child VM using the default `Vue` constructor.
31+
32+
### Fixed
33+
34+
- `event.stopPropagation()` and `event.preventDefault()` inside `v-on` handlers now work as expected.
35+
- `parent` option now works properly when used in `Vue.extend`
36+
- Mustache bindings inside `<textarea>` are now properly interpolated before being set as value.
37+
38+
### Internal
39+
40+
- `v-component`, `v-with` and `v-if` have been re-written for a cleaner compile flow.
41+
- `v-repeat` has been re-written to use refined diff algorithm which triggers minimum DOM manipulations when the array is set to a different instance containing overlapping elements. This makes it efficient to pipe an Array through filters.
42+
- The compiling procedure has been further optimized and instantiation perf has increased roughly 20%.

source/guide/filters.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,22 @@ Vue.filter('wrap', function (value, begin, end) {
8181

8282
When a filter is invoked, its `this` context are set to the ViewModel instance that is invoking it. This allows it to output dynamic results based on the state of the owner ViewModel. In such case, we need to track these accessed properties so that when they change, directives that are using this filter will be re-evaluated.
8383

84-
Filters that relies on the state of the ViewModel that is calling it are referred to as **computed filters**. For example, the built-in `filterBy` and `orderBy` filters are both computed filters. For custom filters, Vue.js checks for computed filters by looking for references to `this` in a filter's function body. Any directive that uses a computed filter will be automatically compiled as an expression so its filters are included in the dependency collection process.
84+
For example:
85+
86+
``` js
87+
Vue.filter('concat', function (value, key) {
88+
// `this` points to the VM invoking the filter
89+
return value + this[key]
90+
})
91+
```
92+
``` html
93+
<input v-model="userInput">
94+
<span>{&#123;msg | concat userInput&#125;}</span>
95+
```
96+
97+
Filters that relies on the state of the ViewModel that is calling it are referred to as **computed filters**. For this simple example above, you can achieve the same result with just an expression, but for more complicated procedures that need more than one statements, you need to put them either in a computed property or a computed filter.
98+
99+
For example, the built-in `filterBy` and `orderBy` filters are both computed filters that performs non-trivial work on the Array being passed in. For custom filters, Vue.js checks for computed filters by looking for references to `this` in a filter's function body. Any directive that uses a computed filter will be automatically compiled as an expression so its filters are included in the dependency collection process.
85100

86101
If you find the concept of computed filters confusing at the moment, don't worry. It is handled automatically by Vue.js and you don't really need to know how it works to leverage it. As you get familiar with more related concepts, it will all make sense.
87102

source/guide/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ In Vue.js, a component is simply a ViewModel constructor registered with an ID u
102102
<li
103103
v-repeat="todos"
104104
v-on="click: done = !done"
105-
class="&#123;&#123;done ? 'done' : ''&#125;&#125;"
106-
>
105+
class="&#123;&#123;done ? 'done' : ''&#125;&#125;">
107106
&#123;&#123;content&#125;&#125;
108107
</li>
109108
</ul>

source/guide/installation.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ $ component install yyx990803/vue
2828
var Vue = require('vue')
2929
```
3030

31+
For edge version (unstable branch, use at your own risk!):
32+
33+
``` bash
34+
$ component install yyx990803/vue@dev
35+
```
36+
3137
## Browserify
3238

3339
``` bash
@@ -37,6 +43,14 @@ $ npm install vue
3743
var Vue = require('vue')
3844
```
3945

46+
For edge version:
47+
48+
``` bash
49+
$ npm install yyx990803/vue#dev
50+
```
51+
52+
<p class="tip">The built version in `dist/` doesn't work with Browserify because it assumes it's loaded in global scope and comes with its own `require` mechanism. Always directly use source version when using Vue with Browserify.</p>
53+
4054
## Bower
4155

4256
``` bash
@@ -47,9 +61,9 @@ $ bower install vue
4761
<script src="bower_components/vue/dist/vue.js">
4862
```
4963
50-
## Module Loaders
64+
## AMD Module Loaders
5165
52-
e.g. RequireJS, SeaJS: Built versions in `/dist` or installed via Bower is wrapped with UMD so it can be used directly as a CommonJS or AMD module.
66+
e.g. RequireJS, SeaJS: Built versions in `/dist` or installed via Bower is wrapped with UMD so it can be used directly as an AMD module.
5367
5468
## Ready?
5569

source/guide/list.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ For Arrays containing primitive values, you can access the value simply as `$val
5050

5151
``` html
5252
<ul id="tags">
53-
<li v-repeat="tags">{&#123;$value&#125;}</li>
53+
<li v-repeat="tags">
54+
{&#123;$value&#125;}
55+
</li>
5456
</ul>
5557
```
5658

@@ -74,6 +76,18 @@ new Vue({
7476
})
7577
</script>
7678

79+
## Using an identifier
80+
81+
Sometimes we might want to have more explicit variable access instead of implicitly falling back to parent scope. You can do that by providing an argument to the `v-repeat` directive and use it as the identifier for the item being iterated:
82+
83+
``` html
84+
<ul id="users">
85+
<!-- think of this as "for each user in users" -->
86+
<li v-repeat="user: users">
87+
{&#123;user.name&#125;} {&#123;user.email&#125;}
88+
</li>
89+
</ul>
90+
```
7791

7892
## Mutation Methods
7993

0 commit comments

Comments
 (0)