diff --git a/README.md b/README.md index 8bf05ec904..a7f87b8081 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,32 @@ # vuejs.org -This site is built with [hexo](http://zespia.tw/hexo/). Site content is written in Markdown format located in `source`. Pull requests welcome! +该站点是通过 [hexo](http://hexo.io/) 搭建起来的。网站内容都是以 Markdown 格式放置在 `source` 目录下的。 +欢迎认领翻译,并发 pull requests 给我:) +为了避免重复翻译,有劳大家在认领之前在 [wiki](https://github.com/Jinjiang/vuejs.org/wiki) 里查阅目前的翻译进度,然后在 [issues](https://github.com/Jinjiang/vuejs.org/issues) 里记录自己认领的页面。 -## Developing +## 如何开始 -Start a dev server at `localhost:4000`: +访问方式:`http://localhost:4000/vuejs.org/`: ``` -$ npm install -g hexo +$ [sudo] npm install -g hexo@2.5.7 $ npm install $ hexo server -``` \ No newline at end of file +``` + +## 贡献者名单 + +(首字母顺序排序) + +* [@etanxing](https://github.com/etanxing) +* [@fengliu222](https://github.com/fengliu222) +* [@Garfielt](https://github.com/Garfielt) +* [@getive](https://github.com/getive) +* [@kunth](https://github.com/kunth) +* [@luin](https://github.com/luin) +* [@nkCoding](https://github.com/nkCoding) +* [@skyline0705](https://github.com/skyline0705) +* [@SoAanyip](https://github.com/SoAanyip) +* [@Suixinlei](https://github.com/Suixinlei) +* [@titancat](http://github.com/titancat) +* [@XfLoops](https://github.com/XfLoops) diff --git a/_config.yml b/_config.yml index cb1d5b0325..21d5b2a6da 100644 --- a/_config.yml +++ b/_config.yml @@ -12,8 +12,8 @@ language: # URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' -url: http://vuejs.org -root: / +url: http://jinjiang.github.io/vuejs.org +root: /vuejs.org/ permalink: :year/:month/:day/:title/ tag_dir: tags archive_dir: archives @@ -97,4 +97,4 @@ markdown: ## Docs: http://zespia.tw/hexo/docs/deployment.html deploy: type: github - repository: git@github.com:vuejs/vuejs.org.git \ No newline at end of file + repository: git@github.com:Jinjiang/vuejs.org.git \ No newline at end of file diff --git a/package.json b/package.json index fa539e6626..2f83ce2d8b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "hexo", - "version": "2.8.3", + "version": "2.5.7", "private": true, "dependencies": { "hexo-renderer-ejs": "^0.1.0", "hexo-renderer-marked": "^0.1.0", "hexo-renderer-stylus": "^0.1.0" } -} +} \ No newline at end of file diff --git a/source/CNAME b/source/CNAME deleted file mode 100644 index 29f5db92ae..0000000000 --- a/source/CNAME +++ /dev/null @@ -1 +0,0 @@ -vuejs.org \ No newline at end of file diff --git a/source/api/directives.md b/source/api/directives.md index dc870c911e..90b2c8213c 100644 --- a/source/api/directives.md +++ b/source/api/directives.md @@ -1,37 +1,37 @@ -title: Directives +title: 指令 type: api order: 6 --- -## Reactive Directives - -> These directives can bind themselves to a property on the Vue instance, or to an expression which is evaluated in the context of the instance. When the value of the underlying property or expression changes, the `update()` function of these directives will be called asynchronously on next tick. - +## 响应式指令 + +> Directive 可以将自己与一个 Vue 实例的属性绑定,也可以与一个运行在实例上下文中的表达式绑定。当底层属性或表达式的值发生改变时,指令的`update()`方法会在下个 tick 异步地调用。 ### v-text -Updates the element's `textContent`. - -Internally, {{ Mustache }} interpolations are also compiled as a `v-text` direcitve on a textNode. +更新元素的`textContent` +本质上来说,{{ Mustache }} 的插值也被当做文字节点上的`v-text`指令进行编译。 ### v-html -Updates the element's `innerHTML`. +更新元素的`innerHTML` -

Using `v-html` with user-supplied data can be dangerous. It is suggested that you only use `v-html` when you are absolutely sure about the security of the data source, or pipe it through a custom filter that sanitizes untrusted HTML.

+

+ 在用户产生的数据中使用`v-html`比较危险。使用`v-html`时应确保数据的安全性,或通过自定义过滤器将不被信任的 HTML 内容进行处理。 +

### v-show -- This directive can trigger transitions. +- 本指令可以触发动画效果。 -Set the element's display to `none` or its original value, depending on the truthy-ness of the binding's value. +根据绑定的真实值将元素的 display 属性设置为`none`或它的原始值。 ### v-class -- This directive accepts an optional argument. - -If no argument is provided, it will add the binding's value to the element's classList, and update the class as the value changes. +- 本元素接受配置参数 -If a directive argument is provided, the argument will be the class to be toggled depending on the binding value's truthy-ness. Combined with multiple clauses this can be pretty useful: +如果没有提供参数名,将会直接将绑定值加入到元素的 classList 中,当绑定值改变时更新元素的 class. + +如果提供了参数名,则会根据绑定值的变化触发元素 class 的改变。多条合并使用会很方便。 ``` html ``` -Internally, {{ Mustache }} interpolations inside attributes are compiled into computed `v-attr` directives. -

You should use `v-attr` instead of mustache binding when setting the `src` attribute on `` elements. Your templates are parsed by the browser before being compiled by Vue.js, so the mustache binding will cause a 404 when the browser tries to fetch it as the image's URL.

+本质上,普通属性中的 {{ Mustache }} 插值会被编译到`v-attr`指令当中。 + +

+ 在为``元素设置`src`属性时,应该使用`v-attr`绑定而不是 mustache 模板绑定。浏览器会先于 Vue.js 对你的模板进行解析。所以当浏览器试图获取图片 URL 时,使用 {{mustache}} 模板绑定的数据会导致404错误。 +

### v-style -- This directive accepts an optional argument. -Apply inline CSS styles to the element. +- 本指令接受一个配置参数 + +将CSS属性以内联的形式应用到元素上。 -When there is no argument, the bound value can either be a String or an Object. +如果没有参数名,绑定值也可以使一个字符串或者一个对象。 -- If it's a String, it will be set as the element's `style.cssText`. -- If it's an Object, each key/value pair will be set on the element's `style` object. +- 如果参数值为字符串,则会将该元素的`style.cssText`属性设置为参数的值。 +- 如果参数值为对象,则每一对 key/value 都会被设置到元素的`style`对象上。 -**Example:** +**例子:** ``` html
@@ -86,9 +89,9 @@ When there is no argument, the bound value can either be a String or an Object. } ``` -When there is an argument, it will be used as the CSS property to apply. Combined with multiple clauses you can set multiple properties together: +如果有参数名的话,参数名会被当作 CSS 属性名使用。可以通过合并多个参数的方式同时设置多个属性。 -**Example:** +**例子:** ``` html
``` -`v-style` is also smart to detect any required browser vendor prefixes, so you can just use the un-prefixed version: +`v-style`也可以智能的查找 CSS 属性是否需要浏览器前缀,所以你可以放心的使用无前缀版本的 CSS 属性。 ``` html
``` -

It is recommended to use `v-style` instead of mustache bindings inside `style` attribute because Internet Explorer, regardless of version, will remove invalid inline styles when parsing the HTML.

+

+ 因为 IE 浏览器的原因,这里推荐使用`v-style`指令来代替直接在 style 属性中使用 {{mustache}} 插值,这是因为在 IE 的所有版本中,都会在解析 HTML 时将非法的内联样式删除掉。 +

### v-on -- This directive requires an argument. -- This directive requires the value to be a Function or a statement. +- 本指令需要一个参数名。 +- 本指令所需的值应该是一个函数或者声明。 + + +为元素添加一个事件监听器。事件的类型由参数名来表示。这也是唯一可以和`key`过滤器一起使用的指令。详细请见[Listening for Events](../guide/events.html)。 -Attaches an event listener to the element. The event type is denoted by the argument. It is also the only directive that can be used with the `key` filter. For more details see [Listening for Events](/guide/events.html). ### v-model -- This directive can only be used on ``, `