diff --git a/README.md b/README.md index 4ef988a0d8..3f866306b7 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,40 @@ -# vuejs.org +# vue.js 2.0 正式版 中文翻译文档(正在进行中...) http://vuefe.cn -This site is built with [hexo](http://hexo.io/). Site content is written in Markdown format located in `src`. Pull requests welcome! +> 基于 hexo && vuejs.org +> 求小伙伴共同翻译,有兴趣加qq 315129552 -## Developing +- 中文翻译分支 2.0-cn -Start a dev server at `localhost:4000`: +## 开发 ``` $ npm install -g hexo-cli $ npm install $ hexo server ``` + +Start a dev server at `localhost:4000` + +## merge + +- 翻译完 pull request 到 2.0-cn 分支 合并 + +## 发布 + +> 预先添加git ssh + +``` +hexo g +hexo d +``` + +## 当前说明(2016.09.26) + +* 基于hexo 和vuejs.org源码 +* 翻译有些滞后,刚刚更新,希望有兴趣的小伙伴直接找我,共勉 +* 文段中英文字母与中文用空一格做间隔,有助于阅读 +* 请尽量对照 vuejs 官方 1.0 中文文档进行翻译,也可以即时看出vue1和vue2直接的区别 +* 导航上 添加了 更新 模块,用于链接到github的 release信息,后面希望单独把changelog放到 /changelog中跟进翻译每次的版本更新内容 +* (畅想:加入热点标记功能 - 点击热点新建github 对应 issue ,话题链接 / 增强文档交互即时纠错) +* (畅想: 首页加入弹幕交互功能) +* (畅想: 添加hacknews-vue2案例解析 以及更多自定义案例解析) diff --git a/_config.yml b/_config.yml index 182ed390e0..7ce6c2a161 100644 --- a/_config.yml +++ b/_config.yml @@ -12,7 +12,7 @@ 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 +url: http://vuefe.cn root: / permalink: :year/:month/:day/:title/ tag_dir: tags @@ -97,7 +97,8 @@ markdown: ## Docs: http://zespia.tw/hexo/docs/deployment.html deploy: type: git - repository: git@github.com:vuejs/vuejs.org.git + repository: git@github.com:vuefe/vuefe.github.io.git + branch: master feed: type: atom diff --git a/package.json b/package.json index 4e94bc532a..4d767e0f17 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "version": "3.2.2" }, "dependencies": { + "hexo-browsersync": "^0.2.0", "hexo": "^3.2.2", "hexo-deployer-git": "0.1.0", "hexo-generator-archive": "^0.1.4", diff --git a/src/CNAME b/src/CNAME index 998cc417c8..ef5fa2c57b 100644 --- a/src/CNAME +++ b/src/CNAME @@ -1 +1 @@ -vuejs.org +vuefe.cn diff --git a/src/about/guide.md b/src/about/guide.md new file mode 100644 index 0000000000..79d4a353b2 --- /dev/null +++ b/src/about/guide.md @@ -0,0 +1,62 @@ +--- +title: 参与指南 +type: about +order: 2 +--- + +- 加QQ群参与翻译: `427447379` +- [翻译Guide认领](https://github.com/vuefe/vuejs.org/issues/1) +- [翻译指引](https://github.com/vuefe/vuejs.org/issues/25) + +## 翻译进度 + +> 原文地址:http://vuejs.org/guide/ +> 仓库:https://github.com/vuefe/vuejs.org + +### 说明 + +- 翻译前,请在此回复认领 +- 认领格式 :` 我翻译 + 文档序号` 即可 + +## 以下所有文档所在目录为 `src/guide/xxx.md` + +### Essentials 基础 + +序号 | 是否完成 | 对应文档文件名 | 中文标题 | 贡献者 | 认领者 +----- | ------- | ------------- | --- | --- | --- +1 | 是 | installation.md | 安装 | @dingyiming | - +2 | 否 | index.md | 介绍 | | @dingyiming +3 | 是 | instance.md | 实例 | @dingyiming | - +4 | × | syntax.md | 模板语法 | | | +5 | 是 | computed.md | 计算属性 | @dingyiming | - +6 | × | class-and-style.md | Class 与 Style 绑定 | | +7 | 是 | conditional.md | 条件渲染 | @dingyiming | - +8 | 是 | list.md | 列表渲染 | @tingtien | @tingtien +9 | 是 | events.md | 事件处理器 | @dingyiming | - +10 | 是 | forms.md | 表单控件绑定 | @dingyiming | - +11 | × | components.md | 组件 | | @ezreally + +### Advanced 进阶 + +序号 | 是否完成 | 对应文档文件名 | 中文标题 | 贡献者 | 认领者 +----- | ------- | ------------- | --- | --- | --- +12 | 是 | transitions.md | 过渡: 进入, 离开, 和 列表 | @awe | @awe +13 | 是 | transitioning-state.md | 过渡状态 | @awe | @awe +14 | 是 | render-function.md | Render 函数 | @awe | @awe +15 | x | reactivity.md | 深入响应式原理 | | @veaba +16 | 是 | custom-directive.md | 自定义指令 | @harrytospring | @harrytospring +17 | 是 | mixins.md | 混合 | @harrytospring | @harrytospring +18 | x | plugins.md | 插件 | | @hgcoder +19 | x | single-file-components.md | 单文件组件 | | +20 | 是 | routing.md | 路由 | @dingyiming | @dingyiming +21 | x | state-management.md | 状态管理 | | +22 | x | unit-testing.md | 单元测试 | | @70data +23 | 是 | ssr.md | 服务端渲染 | @dingyiming | @dingyiming +24 | x | migration.md | 1.x迁移 | | @harrytospring + +### Meta 更多 + +序号 | 是否完成 | 对应文档文件名 | 中文标题 | 贡献者 | 认领者 +----- | ------- | ------------- | --- | --- | --- +25 | x | comparison.md | 对比其他框架 | | @yongbolv @daix6 +26 | x | join.md | 加入Vue.js社区 | | @daix6 diff --git a/src/about/index.md b/src/about/index.md new file mode 100644 index 0000000000..83e2b741fc --- /dev/null +++ b/src/about/index.md @@ -0,0 +1,8 @@ +--- +title: 关于翻译 +type: about +order: 1 +--- + +- 加QQ群参与翻译: `427447379` +- [翻译Guide认领](https://github.com/vuefe/vuejs.org/issues/1) \ No newline at end of file diff --git a/src/awesome/index.md b/src/awesome/index.md new file mode 100644 index 0000000000..812007f959 --- /dev/null +++ b/src/awesome/index.md @@ -0,0 +1,638 @@ +--- +title: 资源 +type: awesome +order: 0 +--- +

+
+ awesome +
+
+

+ +## Awesome Vue.js [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) + +> A curated list of awesome things related to Vue.js +> https://github.com/vuejs/awesome-vue + +- [Official Resources](#official-resources) +- [External Resources](#external-resources) +- [Community](#community) +- [Podcasts](#podcasts) +- [Official Examples](#official-examples) +- [Tutorials](#tutorials) +- [Development Tools](#development-tools) +- [Syntax Highlighting](#syntax-highlighting) +- [Snippets](#snippets) +- [Autocomplete](#autocomplete) +- [Component Collections](#component-collections) +- [Libraries & Plugins](#libraries--plugins) + - [Routing](#routing) + - [Ajax/Data](#ajaxdata) + - [State Management](#state-management) + - [Validation](#validation) + - [UI Components](#ui-components) + - [i18n](#i18n) + - [Examples](#examples) + - [Boilerplates](#boilerplates) + - [Scaffolding](#scaffolding) + - [Integrations](#integrations) + - [General Plugins/Directives](#general-pluginsdirectives) + - [SEO](#seo) +- [Projects Using Vue.js](#projects-using-vuejs) + - [Open Source](#open-source) + - [Apps/Websites](#appswebsites) + - [Interactive Experiences](#interactive-experiences) + - [Enterprise Usage](#enterprise-usage) + +### Official Resources + +- [Official Guide](http://vuejs.org/guide/) +- [API Reference](http://vuejs.org/api/) +- [**GitHub Repo ★22,484**](https://github.com/vuejs/vue) +- [Release Notes](https://github.com/vuejs/vue/releases) + +### External Resources + +- [Vue.js資料まとめ(for japanese)](https://gist.github.com/hashrock/f575928d0e109ace9ad0) by @hashrock +- [Vue.js Newsletter](http://vue-newsletter.com/) - Weekly dose of handpicked Vue.js news +- [Vue.js Jobs](http://govuejs.com/) - A platform to find/post your Vue.js jobs + +### Community + +- [Twitter](https://twitter.com/vuejs) +- [Gitter Chat Room](https://gitter.im/vuejs/vue) +- [Official Forum](http://forum.vuejs.org/) +- [vue-requests ★27](https://github.com/vuejs/vue-requests) - Request a Vue.js module you wish existed or get ideas for modules + +### Podcasts + +- [Full Stack Radio #30 (11-23-2015)](http://www.fullstackradio.com/30) +- [JavaScript Jabber #187 (11-25-2015)](https://devchat.tv/js-jabber/187-jsj-vue-js-with-evan-you) +- [Changelog #184 (11-27-2015)](https://changelog.com/184/) +- [Software Engineering Daily (12-29-2015)](http://softwareengineeringdaily.com/2015/12/29/front-end-javascript-with-evan-you/) +- [Javascript Air 016 (03-30-2016)](https://javascriptair.com/episodes/2016-03-30/) +- [Codecasts #2 - Falando Sobre Vuejs e Web Components (2016-08-19) [pt-BR]](https://soundcloud.com/codecasts/2-falando-sobre-vuejs-e-web-components) +- [Full Stack Radio #50 (09-21-2016)](http://www.fullstackradio.com/50) + +### Official Examples + +- [Basic Examples](http://vuejs.org/guide/) +- [Vue.js TodoMVC](https://github.com/vuejs/vue/tree/dev/examples/todomvc) + - [CoffeeScript Version ★5](https://github.com/anfelor/TodoMVC-CoffeeScript-and-Vue.js) +- [**Vue.js HackerNews Clone ★1,277**](https://github.com/vuejs/vue-hackernews) + +### Tutorials + +- [Vue.js screencasts](https://laracasts.com/series/learning-vue-step-by-step) on Laracasts +- [What's New in Vue.js 1.0](http://www.sitepoint.com/whats-new-in-vue-js-1-0/) on Sitepoint +- [Build an App with Vue.js: From Authentication to Calling an API](https://auth0.com/blog/2015/11/13/build-an-app-with-vuejs/) on Auth0 blog +- [Create a GitHub File Explorer Using Vue.js](https://scotch.io/tutorials/create-a-github-file-explorer-using-vue-js) on Scotch.io +- [Vue.js Tutorial](http://vegibit.com/vue-js-tutorial/) on Vegibit +- [Vue.js build set-up from scratch with webpack, vue-loader and hot reload](http://skyronic.com/2015/12/28/vue-project-scratch/) +- [Vuex basics: Tutorial and explanation](http://skyronic.com/2016/01/03/vuex-basics-tutorial/) +- [Vuex introduction video - James Browne from London Vue.js Meetup #1](https://www.youtube.com/watch?v=l1KHL-TX3qs) +- [Vue.js 中文系列视频教程](https://laravist.com/series/vue-js-1-0-in-action-series) on Laravist +- [Vue.js: The Basics](http://coligo.io/vuejs-the-basics/) on Coligo.io +- [VueJs: Components](https://coligo.io/vuejs-components/) on Coligo.io +- [Dynamic Components in Vue.js](https://coligo.io/dynamic-components-in-vuejs/) on Coligo.io +- [Develop a Reactive Invoice App using Vue.js](http://craigmckenna.com/develop-a-reactive-invoice-app-using-vue-js/) on craigmckenna.com +- [Understanding Filters in Vue.js](http://coligo.io/vuejs-filters/) on Coligo.io +- [Hybrid App Example with Laravel and Vue.js in portuguese](https://www.youtube.com/watch?v=TGSJjDahlrQ) by @vedovelli +- [Creating a Markdown Editor with VueJs and GitHub's API](http://coligo.io/markdown-editor-vuejs/) on Coligo.io +- [Building a Real-Time Web Analytics Dashboard with NodeJs, Socket.io, and VueJs](http://coligo.io/real-time-analytics-with-nodejs-socketio-vuejs/) on Coligo.io +- [Vue.js Introduction Turkish Language](http://oguzhan.in/vue-js-ile-uygulama-gelistirme/) on oguzhan.in +- [Vue.js VideoTutoral Series in Spanish (3-8-2016)](https://www.youtube.com/watch?v=IlFk3cyRB0Y&list=PLM-Y_YQmMEqD2EWfWpSbiV3WgShRRW3FE&index=7) on YouTube by Juan Andrés Núñez +- [Building a Bookmarking App with Electron, VueJs, and Firebase](http://coligo.io/bookmarking-app-electron-vuejs-firebase/) on Coligo.io +- [Learn Vuex by Building a Notes App](https://coligo.io/learn-vuex-by-building-notes-app/) on Coligo.io +- [Vue.js Screencast Series in Spanish](https://styde.net/curso-de-vue-js/) on Styde.net +- [**讲解Vue.js 官网 中文-含代码、百度云、youtube ★277**](https://github.com/bhnddowinf/vuejs-learn) on bhnddowinf +- [Exploring Real Time Apps with VueJS, ES2015 and Webpack](https://blog.pusher.com/exploring-real-time-apps-with-vuejs-es2016-and-webpack/) on Pusher +- [Vue.js in Bahasa Indonesia] (https://www.sekolahkoding.com/track/belajar-vue-js) on sekolahkoding.com +- [Building a Mobile App with Cordova and Vue.js](https://coligo.io/building-a-mobile-app-with-cordova-vuejs/) on Coligo.io +- [Vue.js from Scratch Series in Russian](https://www.youtube.com/playlist?list=PL5r0NkdgM0UOxb4Hl81FV5UIgexwTf8h7) on YouTube by .dev +- [Створення сервісу для зберігання файлів з Flask, RethinkDB та Vue.js, ч. 1](http://codeguida.com/post/526/) Ukraine +- [VueJS 2 French tutorial](https://www.youtube.com/playlist?list=PLjwdMgw5TTLW-mAtlR46VajrKs4dep3y0) Français par Grafikart + +#### 0.12 and earlier + +- [Vue.js screencasts](https://laracasts.com/series/learning-vuejs) on Laracasts 0.12 +- [Build an App with Vue.js](https://scotch.io/tutorials/build-an-app-with-vue-js-a-lightweight-alternative-to-angularjs) on Scotch.io 0.12 +- [Getting Started with Vue.js](http://www.sitepoint.com/getting-started-with-vue-js/) on Sitepoint 0.12 +- [Vue.js video series in portuguese](http://forum.vuejs.org/topic/49/vue-js-video-series-in-portuguese) 0.12 +- [Vue.js video series in russian](http://ausite.ru/category/js/vue-js) on Ausite 0.12 +- [A Quick Introduction to Vue.js](http://mattsparks.com/a-quick-introduction-to-vue-js/) by Matt Sparks 0.12 +- [Getting Started with Vue.js + vue-router](https://www.youtube.com/watch?v=QN7l3ydXvx0) by Michael Calkins 0.12 +- [Many JS Frameworks but Vue.js Is Different](http://taha-sh.com/blog/many-js-frameworks-but-vuejs-is-different) by Taha Shashtari 0.12 +- [Getting Started with Vue.js - AngularJS perspective](http://fadeit.dk/blog/post/getting-started-with-vuejs-angularjs-perspective) by Dan Mindru 0.11 + +### Development Tools + +- [**vue-cli ★1,115**](https://github.com/vuejs/vue-cli): official CLI for scaffolding Vue.js projects. +- [**vue-loader ★643**](https://github.com/vuejs/vue-loader) - Vue component loader for Webpack. +- [**vueify ★494**](https://github.com/vuejs/vueify) - Vue component transform for Browserify. +- [**vue-devtools ★934**](https://github.com/vuejs/vue-devtools) - Chrome devtools extension for debugging Vue applications. +- [grunt-vueify ★2](https://github.com/SkewedAspect/grunt-vueify) - Translate `.vue` files to pure JavaScript, without using Browserify. (Useful for Electron apps) +- [vue-compiler ★2](https://github.com/paulpflug/vue-compiler) - A simple CLI wrapper around vueify +- [vue-autocompile](https://atom.io/packages/vue-autocompile) - Atom.io package to compile `.vue` files on save. +- [vue-dev-server ★5](https://github.com/paulpflug/vue-dev-server) - A small webpack-based development server for building standalone `vue` components +- [vue-go-cli ★5](https://github.com/rodzzlessa24/vue-go-cli) - a CLI tool for scaffolding new projects generating components, services, and mixins. +- [brunch-vue ★9](https://github.com/nblackburn/vue-brunch) - Adds support to Brunch for pre-compiling single file Vue components. +- [vueify-extract-css ★23](https://github.com/rawcreative/vueify-extract-css) - Browserify plugin to extract css from Vueify-compiled single file components to a separate css file. +- [eslint-plugin-vue ★29](https://github.com/Twiknight/eslint-plugin-vue) - Eslint plugin for .vue files. +- [**vbuild ★119**](https://github.com/egoist/vbuild) - Preset build tool for Vue.js apps. +- [vue-markdown-loader ★2](https://github.com/QingWei-Li/vue-markdown-loader) Convert Markdown file to Vue Component using markdown-it. + +### Syntax Highlighting + +- [**Sublime Text ★244**](https://github.com/vuejs/vue-syntax-highlight) +- [Atom](https://atom.io/packages/language-vue) by @hedefalk +- [Atom (2)](https://atom.io/packages/language-vue-component) by @CYBAI +- [Vim ★48](https://github.com/posva/vim-vue) by @darthmall and @posva +- [Visual Studio Code](https://marketplace.visualstudio.com/items/liuji-jim.vue) by Jim Liu +- [Brackets ★11](https://github.com/pandao/brackets-vue) by @pandao +- [**IntelliJ IDEA / WebStorm ★199**](https://github.com/henjue/vue-for-idea) by @henjue +- [Emacs ★10](https://github.com/CodeFalling/vue-mode) by @CodeFalling +- [Visual Studio 2015 ★7](https://github.com/madskristensen/VuePack) by @madskristensen + +### Snippets + +- [vue-snippets](https://atom.io/packages/vue-snippets) for Atom.io by [@ealves-pt](https://github.com/ealves-pt) +- [Vue.js Brazil Code Snippets](https://github.com/vuejs-br/snippets) + - [Use multiple files in vue-router](https://github.com/vuejs-br/snippets/blob/master/router/use-multiple-files.md) + - [Vue Permission Directive](https://github.com/vuejs-br/snippets/blob/master/directives/vue-permission.md) + - [Bootstrap status label (v-label)](https://github.com/vuejs-br/snippets/blob/master/directives/v-label.md) + +### Autocomplete + +- [vue-autocomplete](https://atom.io/packages/vue-autocomplete) for Atom.io by [@ealves-pt](https://github.com/ealves-pt) +- [google-autocomplete ★9](https://github.com/gocanto/google-autocomplete) An easy approach to achieve address autocomplete from google map. by [@gocanto](https://github.com/gocanto) + +### Component Collections + +- [VueStrap](http://yuche.github.io/vue-strap/), Bootstrap components built with pure Vue.js by @yuche 1.0 +- [VueBoot](http://morgul.github.io/vueboot/), Bootstrap v4 components by @Morgul 1.0 +- [**vue-mdl ★436**](https://github.com/posva/vue-mdl): Reusable Vue.js components using Material Design Lite. By [@posva](https://github.com/posva) +- [Extra Vuestrap components](http://gritcode.github.io/gritcode-components/#/toast), more components built with just B4 and Vue.js, by @kzima 1.0 +- [VueStrap Base Components](http://kzima.github.io/vuestrap-base-components/#/accordion), A complete set of Bootstrap 4 web components built with pure Vue.js, by @kzima 1.0 +- [**Vux ★2,570**](https://github.com/airyland/vux): Mobile web UI Components based on Vue and WeUI. By [@airyland](https://github.com/airyland) +- [Vue Material Components](http://appcomponents.org/material-components/): Vue.js UI components using [materializecss.com](http://materializecss.com/) by mjanys +- [Vue Upload Component](https://github.com/lian-yue/vue-upload-component/): Vue.js Multiple file upload component support ie9 [lianyue.org](http://www.lianyue.org) by LianYue +- [vue-comps](https://github.com/vue-comps): A collection of unstyled and unanimated plain vue components + - [vue-materialize ★66](https://github.com/paulpflug/vue-materialize): materializeCss styles and animations for `vue-comps` + - [vue-clusterize ★28](https://github.com/vue-comps/vue-clusterize): implementation of clusterize.js in vue, invisible pagination + - [vue-data-table ★7](https://github.com/vue-comps/vue-data-table): A high-customizable data-table based on vue-clusterize + - [vue-side-nav ★9](https://github.com/vue-comps/vue-side-nav): responsive, touch enabled side nav + - [vue-parallax ★3](https://github.com/vue-comps/vue-parallax): Scrolls a image slower than the window to create a neat optical effect + - [vue-zoombox ★0](https://github.com/vue-comps/vue-zoombox): implementation of [zoomerang](https://github.com/yyx990803/zoomerang), Zooms into everything (images, text) - without animations + - [vue-icons ★10](https://github.com/vue-comps/vue-icons): webpack based - load only what you need - svg inline icons - font compatible mode - fa, material, mdi and octicons +- [**keen-ui ★551**](https://github.com/JosephusPaye/Keen-UI): A collection of essential UI components inspired by Material Design +- [material-ui-vue](http://material-ui-vue.jackyang.me/docs/index.html#!/components/badges/badge): materializecss UI components with Vue, by [@jack](https://github.com/JackGit) +- [vue-spectre](https://vace.me/a/vue-spectre/index.html): [github](https://github.com/vace/vue-spectre),spectre components built with Vue.js by [@vace](http://github.com/vace) 1.0 +- [**vue-desktop ★219**](https://github.com/ElemeFE/vue-desktop): A UI library for building admin panel website, by [@ElemeFE](https://github.com/ElemeFE) +- [smart ★25](https://github.com/shenlq/smart): Reusable mobile components based on Vue, by [@shenlq](https://github.com/shenlq) +- [**vue-admin ★397**](https://github.com/fundon/vue-admin): Vue Admin Panel Framework, by [@fundon](https://github.com/fundon) +- [vue-kit ★3](https://github.com/gismall/vue-kit): Vue Website Framework, by [@gismall](https://github.com/gismall),[demo:http://vue-kit.gismall.com](http://vue-kit.gismall.com) +- [vue-material-design ★11](https://github.com/loujiayu/vue-material-design): A set of material components by [@loujiayu](https://github.com/loujiayu) +- [**mint-ui ★1,533**](https://github.com/ElemeFE/mint-ui): Mobile UI elements for Vue.js, by [@ElemeFE](https://github.com/ElemeFE) +- [searchable-select-dropdown ★3](https://github.com/rahulgaba16/searchable-select-dropdown): A Vue Component to convert the native html select-dropdown to searchable dropdown by [@rahulgaba16](https://github.com/rahulgaba16) +- [**Vuikit ★300**](https://github.com/vuikit/vuikit): A collection of Vue components built on top of the awesome [UIkit](http://getuikit.com) framework +- [vue-bulma](https://github.com/vue-bulma): Vue Bulma UI Components, by [@fundon](https://github.com/fundon) + - [vue-bulma-breadcrumb](https://github.com/vue-bulma/breadcrumb): Breadcrumb component for Vue Bulma + - [vue-bulma-collapse](https://github.com/vue-bulma/collapse): Collapse component for Vue Bulma + - [vue-bulma-chartjs](https://github.com/vue-bulma/chartjs): Chartjs component is based on chart.js for Vue Bulma + - [vue-bulma-chartist](https://github.com/vue-bulma/chartist): Chartist component is based on Chartist for Vue Bulma + - [vue-bulma-datepicker](https://github.com/vue-bulma/datepicker): Datepicker component is based on flatpickr for Vue Bulma + - [vue-bulma-message](https://github.com/vue-bulma/message): Message component for Vue Bulma + - [vue-bulma-modal](https://github.com/vue-bulma/modal): Modal component for Vue Bulma + - [vue-bulma-notification](https://github.com/vue-bulma/notification): Notification component for Vue Bulma + - [vue-bulma-progress-bar](https://github.com/vue-bulma/progress-bar): ProgressBar component for Vue Bulma + - [vue-bulma-progress-tracker](https://github.com/vue-bulma/progress-tracker): ProgressTracker component is based on progress-tracker for Vue Bulma + - [vue-bulma-rating](https://github.com/vue-bulma/rating): Rating component is based on starability.css for Vue Bulma + - [vue-bulma-slider](https://github.com/vue-bulma/slider): Slider component for Vue Bulma + - [vue-bulma-switch](https://github.com/vue-bulma/switch): Switch component for Vue Bulma + - [vue-bulma-tabs](https://github.com/vue-bulma/tabs): Tabs component for Vue Bulma + - [vue-bulma-tooltip](https://github.com/vue-bulma/tooltip): Tooltip component is based on hint.css for Vue Bulma + - [vue-bulma-expanding](https://github.com/vue-bulma/expanding): The Expanding Transition Component for Vue 2.0 +- [vue-disqus](https://github.com/ktquez/vue-disqus): Vue component to integrate Disqus comments in your application, with support for SPA +- [BootInput](https://github.com/neposoft/bootinput-vuejs), Bootstrap input components for vuejs with validation, and form-group cascade. By [@neposoft](https://github.com/neposoft) +- [vue-easy-slider](https://github.com/shhdgit/vue-easy-slider): Slider component for Vue.js with control button. By [@Suhaha](https://github.com/shhdgit) +- [vue-carbon](https://github.com/myronliu347/vue-carbon) Material Design Mobile UI Components +- [quasar-framework ★220](https://github.com/rstoenescu/quasar-framework) SPA front-end framework on steroids. Endless list of components with Material and iOS themes. By [@rstoenescu](https://github.com/rstoenescu) +- [N3-components](https://github.com/N3-components/N3-components) - A UI library, by [@zhangking](https://github.com/zhangking) Websites & native mobile Apps. Full Stack Toolkit. +- [vue-core-image-upload](https://github.com/Vanthink-UED/vue-core-image-upload): A vue plugin for image to crop and upload [@Vanthink-UED](https://github.com/Vanthink-UED) +- [ElementUI](https://github.com/ElemeFE/element): Desktop UI elements for Vue.js 2.0 [@ElemeFE](https://github.com/ElemeFE) + + + +### Libraries & Plugins + +- #### Routing + + - [**vue-router ★1,619**](https://github.com/vuejs/vue-router) - Official router for building SPAs. 1.0 compatible + - [Vue page ★15](https://github.com/AlexToudic/vue-page), a routing system based on pagejs by @AlexToudic + - [Vue Lanes ★21](https://github.com/bpierre/vue-lanes), an event-based routing system for Vue by @bpierre + - [Vue route ★73](https://github.com/ayamflow/vue-route), ng-view inspired routes for Vue by @ayamflow + - [**voie ★130**](https://github.com/inca/voie) — simple router / layout manager inspired by FSMs and ui-router by [Boris Okunskiy](https://github.com/inca)1.0 + - [vue-script2 ★6](https://github.com/taoeffect/vue-script2) - Load route-specific code or vendor scripts with a ` {% endraw %} -Here we have declared a computed property `reversedMessage`. The function we provided will be used as the getter function for the property `vm.reversedMessage`: + +这里我们声明了一个计算属性 `reversedMessage`。我们提供的函数将用作属性 `vm.reversedMessage`的 getter。 ``` js console.log(vm.reversedMessage) // -> 'olleH' @@ -73,9 +76,9 @@ vm.message = 'Goodbye' console.log(vm.reversedMessage) // -> 'eybdooG' ``` -You can open the console and play with the example vm yourself. The value of `vm.reversedMessage` is always dependent on the value of `vm.message`. +你可以打开浏览器的控制台,修改 vm。`vm.reversedMessage` 的值始终取决于 `vm.message` 的值。 -You can data-bind to computed properties in templates just like a normal property. Vue is aware that `vm.reversedMessage` depends on `vm.message`, so it will update any bindings that depend on `vm.reversedMessage` when `vm.message` changes. And the best part is that we've created this dependency relationship declaratively: the computed getter function is pure and has no side effects, which makes it easy to test and reason about. +你可以像绑定普通属性一样在模板中绑定计算属性。Vue 知道 `vm.reversedMessage` 依赖于 `vm.message`,因此当 `vm.message` 发生改变时,依赖于 `vm.reversedMessage` 的绑定也会更新。而且最妙的是我们是声明式地创建这种依赖关系:计算属性的 getter 是干净无副作用的,因此也是易于测试和理解的。 ### Computed Caching vs Methods @@ -110,9 +113,9 @@ In comparison, a method invocation will **always** run the function whenever a r Why do we need caching? Imagine we have an expensive computed property **A**, which requires looping through a huge Array and doing a lot of computations. Then we may have other computed properties that in turn depend on **A**. Without caching, we would be executing **A**’s getter many more times than necessary! In cases where you do not want caching, use a method instead. -### Computed vs Watched Property +### 计算属性 vs watch -Vue does provide a more generic way to observe and react to data changes on a Vue instance: **watch properties**. When you have some data that needs to change based on some other data, it is tempting to overuse `watch` - especially if you are coming from an AngularJS background. However, it is often a better idea to use a computed property rather than an imperative `watch` callback. Consider this example: +Vue.js 提供了一个方法 `$watch`,它用于观察 Vue 实例上的数据变动。当一些数据需要根据其它数据变化时, `$watch` 很诱人 —— 特别是如果你来自 AngularJS。不过,通常更好的办法是使用计算属性而不是一个命令式的 `$watch` 回调。考虑下面例子: ``` html
{{ fullName }}
@@ -137,7 +140,7 @@ var vm = new Vue({ }) ``` -The above code is imperative and repetitive. Compare it with a computed property version: +上面代码是命令式的重复的。跟计算属性对比: ``` js var vm = new Vue({ @@ -154,11 +157,11 @@ var vm = new Vue({ }) ``` -Much better, isn't it? +这样更好,不是吗? -### Computed Setter +### 计算 setter -Computed properties are by default getter-only, but you can also provide a setter when you need it: +计算属性默认只是 getter,不过在需要时你也可以提供一个 setter: ``` js // ... @@ -179,15 +182,17 @@ computed: { // ... ``` -Now when you run `vm.fullName = 'John Doe'`, the setter will be invoked and `vm.firstName` and `vm.lastName` will be updated accordingly. +现在在调用 `vm.fullName = 'John Doe'` 时,setter 会被调用,`vm.firstName` 和 `vm.lastName` 也会有相应更新。 -## Watchers +关于计算属性背后的原理和技术细节详见[计算属性的奥秘](http://rc.vuejs.org/guide/reactivity.html#Inside-Computed-Properties)。 -While computed properties are more appropriate in most cases, there are times when a custom watcher is necessary. That's why Vue provides a more generic way to react to data changes through the `watch` option. This is most useful when you want to perform asynchronous or expensive operations in response to changing data. +## 观察 Watchers -For example: +当计算属性使用在大多数场景下时,有时候也很需要一个自定义的数watcher.这是为什么Vue提供一个更通用的方法通过`watch`的设置,来反应数据的变化。在你想要执行异步操作或需要响应不断变化昂贵的数据操作时这很有用。 -``` html +例如: + +```html

Ask a yes/no question: @@ -197,7 +202,7 @@ For example:

``` -``` html +```html @@ -251,10 +256,11 @@ var watchExampleVM = new Vue({ ``` -Result: + +结果: {% raw %} -
+

Ask a yes/no question: @@ -271,6 +277,7 @@ var watchExampleVM = new Vue({ answer: 'I cannot give you an answer until you ask a question!' }, watch: { + // whenever question changes, this function will run question: function (newQuestion) { this.answer = 'Waiting for you to stop typing...' this.getAnswer() @@ -293,6 +300,8 @@ var watchExampleVM = new Vue({ vm.answer = 'Error! Could not reach the API. ' + error }) }, + // This is the number of milliseconds we wait for the + // user to stop typing. 500 ) } @@ -300,6 +309,13 @@ var watchExampleVM = new Vue({ {% endraw %} -In this case, using the `watch` option allows us to perform an asynchronous operation (accessing an API), limit how often we perform that operation, and set intermediary states until we get a final answer. None of that would be possible with a computed property. +在这个示例中,使用`watch`的设置允许我们执行异步操作(访问一个接口),限制我们多久执行该操作,并在我们获取最终结果时立刻设置状态。这是计算属性无法做到的。 + +关于`watch` 选项,可看API文档[vm.$watch API](/api/#vm-watch)。 + +*** + +> 原文:http://rc.vuejs.org/guide/computed.html + +*** -In addition to the `watch` option, you can also use the imperative [vm.$watch API](/api/#vm-watch). diff --git a/src/guide/conditional.md b/src/guide/conditional.md index 7c8166aa59..abd3894453 100644 --- a/src/guide/conditional.md +++ b/src/guide/conditional.md @@ -1,36 +1,36 @@ --- -title: Conditional Rendering +title: 条件渲染 type: guide order: 7 --- ## v-if -In string templates, for example Handlebars, we would write a conditional block like this: +在字符串模板中,如 Handlebars,我们得像这样写一个条件块: ``` html - + {{#if ok}}

Yes

{{/if}} ``` -In Vue, we use the `v-if` directive to achieve the same: +在 Vue.js,我们使用 `v-if` 指令实现同样的功能: ``` html

Yes

``` -It is also possible to add an "else" block with `v-else`: +也可以用 `v-else` 添加一个 "else" 块: ``` html

Yes

No

``` -### Template v-if +## template v-if -Because `v-if` is a directive, it has to be attached to a single element. But what if we want to toggle more than one element? In this case we can use `v-if` on a `