You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by 1xuanyuan1 <gi...@git.apache.org> on 2018/01/23 10:28:53 UTC
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
GitHub user 1xuanyuan1 opened a pull request:
https://github.com/apache/incubator-weex-site/pull/46
1.新增中文版 在 Weex 中使用 Vue.js 2.修改了英文版的一个小问题
1.新增中文版 在 Weex 中使用 Vue.js
2.修改了英文版的一个小问题
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/1xuanyuan1/incubator-weex-site use-vue-branch
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-weex-site/pull/46.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #46
----
commit c181aa9daaa6ed0e779e970b4d8101e4a8d5b8be
Author: Duke <da...@...>
Date: 2018-01-23T10:27:51Z
1.新增中文版 在 Weex 中使用 Vue.js 2.修改了英文版的一个小问题
----
---
[GitHub] incubator-weex-site issue #46: 1.��������������� ��� Weex ��������� Vue.js 2...
Posted by 1xuanyuan1 <gi...@git.apache.org>.
Github user 1xuanyuan1 commented on the issue:
https://github.com/apache/incubator-weex-site/pull/46
1.Add the Chinese page of use-vue.md
2.fix a bug in the English page of use-vue.md
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on a diff in the pull request:
https://github.com/apache/incubator-weex-site/pull/46#discussion_r163444462
--- Diff: source/cn/guide/use-vue.md ---
@@ -5,7 +5,280 @@ group: Overview
order: 1.6
version: 2.1
---
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
-Working in progress.
+自2016年2月17日发布WeexSDK [v0.10.0](https://github.com/alibaba/weex/releases/tag/v0.10.0)后,Weex集成了v2版本的Vue。Vue(读音 /vjuː/,类似于 view 的读音)是一套构建用户界面(user interface)的渐进式框架。详情请参阅其[官方网站](https://cn.vuejs.org/)。
-Please refer to the [English version](../../guide/use-vue.html).
+> 如果没有特别指示, 文章中的"Vue.js"或者"Vue"都指的是v2版本的Vue。
+
+## 只含有运行时的构建版本
+
+如果你熟悉Vue.js,你应该知道Vue.js有两种构建版本: [**运行时 + 编译器** 与 **只包含运行时**](https://cn.vuejs.org/v2/guide/installation.html#%E8%BF%90%E8%A1%8C%E6%97%B6-%E7%BC%96%E8%AF%91%E5%99%A8-vs-%E5%8F%AA%E5%8C%85%E5%90%AB%E8%BF%90%E8%A1%8C%E6%97%B6)。它们之间的区别在于编译器是否需要能够在运行时编译`template`选项。由于运行时构建版本比完整版本的构建版本轻约30%,为了更好的性能和更少的代码尺寸,Weex用的是只包含运行时的方式构建Vue。
+
+具体来说,差异如下:
+
++ 定义组件时不支持[`template`](https://cn.vuejs.org/v2/api/#template)选项。
++ 不支持使用[`x-templates`](https://cn.vuejs.org/v2/guide/components.html#X-Templates).
++ 不支持使用[`Vue.compile`](https://cn.vuejs.org/v2/api/#Vue-compile).
+
+## 平台的差异
+
+Vue.js最初是为Web平台设计的。虽然可以基于Weex开发原生应用程序,但是仍然存在许多[Weex 与 Web 平台的差异](../wiki/platform-difference.html)。
+
+与 Web 平台的主要差异是: 上下文、DOM、样式和事件。
+
+### 上下文
+Weex主要用于编写多页的应用程序,每一页相当于原生开发中的 *View* 或者 *Activity*,并且它有着自己的上下文。尤其`Vue`实例在每个页面都是不同的,甚至Vue的"全局"配置(`Vue.config.xxx`)也只会影响Weex上的单个页面。
+
+在此基础上,一些Vue的SPA(单页面应用)技术,如[Vuex](https://vuex.vuejs.org/zh-cn/)和[vue-router](https://router.vuejs.org/zh-cn/)也将单页内生效。更通俗地说,“页面”概念在SPA技术中是虚拟的,但在Weex上却是真实的。
+
+无论如何,Vuex和vue-路由器都是独立的库,它们都有自己的概念和使用场景,你仍然可以在Weex里[使用Vuex和vue-router](./advanced/use-vuex-and-vue-router.html)。
+
+### DOM
+
+因为在Android和iOS上没有DOM(document object mode),如果你要手动操作和生成DOM元素的话可能会遇到一些兼容性问题。在你使用现代前端框架的情况下,操作数据与组件而不是生成的元素是一个比较好的做法。
+
+一些与dom相关的特性,比如`v-html`, `vm.$el`, `template`选项,在不同的平台上可能无法获得相同的反应。
+
+准确来说,[`vm.$el`](https://cn.vuejs.org/v2/api/#vm-el)属性类型在web环境下是 `HTMLElement`,但是在移动端并没有这个类型。实际上,它是一个由 *Weex文档对象模型* 定义的特殊数据结构。
+
+### 样式
+
+样式表和CSS规则是由Weex js框架和原生渲染引擎管理的。要实现完整的CSS对象模型(CSSOM:CSS Object Model)并支持所有的CSS规则是非常困难的,而且没有这个必要。
+
+出现性能考虑,**Weex目前只支持单个类选择器,并且只支持CSS规则的子集**。详情请参阅 *[通用样式](../wiki/common-styles.html)* 与 *[文本样式](../wiki/text-styles.html)*。
+
+在Weex里, 每一个Vue组件的样式都是 *[scoped](https://vue-loader.vuejs.org/zh-cn/features/scoped-css.html)*。
+
+### 事件
+
+目前在Weex里不支持事件冒泡和捕获,因此Weex原生组件不支持[事件修饰符](https://cn.vuejs.org/v2/guide/events.html#%E4%BA%8B%E4%BB%B6%E4%BF%AE%E9%A5%B0%E7%AC%A6),例如`.prevent`, ` .capture`, `.stop`, ` .self` 。
+
+此外,[按键修饰符](https://cn.vuejs.org/v2/guide/events.html#%E6%8C%89%E9%94%AE%E4%BF%AE%E9%A5%B0%E7%AC%A6)以及[系统修饰键](https://cn.vuejs.org/v2/guide/events.html#%E7%B3%BB%E7%BB%9F%E4%BF%AE%E9%A5%B0%E9%94%AE) 例如 `.enter`, `.tab`, `.ctrl`, `.shift` 在移动端基本没有意义,在Weex中也不支持。
+
+## Web渲染器
+
+如果你想在网络上呈现你的页面,你需要[weex-vue-render](https://github.com/weexteam/weex-vue-render)来实现它。
+
+`weex-vue-render`是Vue DSL的web渲染器, 它在web上实现了Weex的内置组件和内置模块。详情请参阅[这](https://github.com/weexteam/weex-vue-render)。
--- End diff --
请参阅这里
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/incubator-weex-site/pull/46
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on a diff in the pull request:
https://github.com/apache/incubator-weex-site/pull/46#discussion_r163441614
--- Diff: source/cn/guide/use-vue.md ---
@@ -5,7 +5,280 @@ group: Overview
order: 1.6
version: 2.1
---
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
--- End diff --
License annotation is not required for documents (`*.md` files).
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on a diff in the pull request:
https://github.com/apache/incubator-weex-site/pull/46#discussion_r163442826
--- Diff: source/cn/guide/use-vue.md ---
@@ -5,7 +5,280 @@ group: Overview
order: 1.6
version: 2.1
---
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
-Working in progress.
+自2016年2月17日发布WeexSDK [v0.10.0](https://github.com/alibaba/weex/releases/tag/v0.10.0)后,Weex集成了v2版本的Vue。Vue(读音 /vjuː/,类似于 view 的读音)是一套构建用户界面(user interface)的渐进式框架。详情请参阅其[官方网站](https://cn.vuejs.org/)。
-Please refer to the [English version](../../guide/use-vue.html).
+> 如果没有特别指示, 文章中的"Vue.js"或者"Vue"都指的是v2版本的Vue。
+
+## 只含有运行时的构建版本
+
+如果你熟悉Vue.js,你应该知道Vue.js有两种构建版本: [**运行时 + 编译器** 与 **只包含运行时**](https://cn.vuejs.org/v2/guide/installation.html#%E8%BF%90%E8%A1%8C%E6%97%B6-%E7%BC%96%E8%AF%91%E5%99%A8-vs-%E5%8F%AA%E5%8C%85%E5%90%AB%E8%BF%90%E8%A1%8C%E6%97%B6)。它们之间的区别在于编译器是否需要能够在运行时编译`template`选项。由于运行时构建版本比完整版本的构建版本轻约30%,为了更好的性能和更少的代码尺寸,Weex用的是只包含运行时的方式构建Vue。
+
+具体来说,差异如下:
+
++ 定义组件时不支持[`template`](https://cn.vuejs.org/v2/api/#template)选项。
++ 不支持使用[`x-templates`](https://cn.vuejs.org/v2/guide/components.html#X-Templates).
++ 不支持使用[`Vue.compile`](https://cn.vuejs.org/v2/api/#Vue-compile).
--- End diff --
use `。`.
---
[GitHub] incubator-weex-site issue #46: 1.��������������� ��� Weex ��������� Vue.js 2...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on the issue:
https://github.com/apache/incubator-weex-site/pull/46
Thanks for your contribution! Please use English in the commit log.
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on a diff in the pull request:
https://github.com/apache/incubator-weex-site/pull/46#discussion_r163444366
--- Diff: source/cn/guide/use-vue.md ---
@@ -5,7 +5,280 @@ group: Overview
order: 1.6
version: 2.1
---
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
-Working in progress.
+自2016年2月17日发布WeexSDK [v0.10.0](https://github.com/alibaba/weex/releases/tag/v0.10.0)后,Weex集成了v2版本的Vue。Vue(读音 /vjuː/,类似于 view 的读音)是一套构建用户界面(user interface)的渐进式框架。详情请参阅其[官方网站](https://cn.vuejs.org/)。
-Please refer to the [English version](../../guide/use-vue.html).
+> 如果没有特别指示, 文章中的"Vue.js"或者"Vue"都指的是v2版本的Vue。
+
+## 只含有运行时的构建版本
+
+如果你熟悉Vue.js,你应该知道Vue.js有两种构建版本: [**运行时 + 编译器** 与 **只包含运行时**](https://cn.vuejs.org/v2/guide/installation.html#%E8%BF%90%E8%A1%8C%E6%97%B6-%E7%BC%96%E8%AF%91%E5%99%A8-vs-%E5%8F%AA%E5%8C%85%E5%90%AB%E8%BF%90%E8%A1%8C%E6%97%B6)。它们之间的区别在于编译器是否需要能够在运行时编译`template`选项。由于运行时构建版本比完整版本的构建版本轻约30%,为了更好的性能和更少的代码尺寸,Weex用的是只包含运行时的方式构建Vue。
+
+具体来说,差异如下:
+
++ 定义组件时不支持[`template`](https://cn.vuejs.org/v2/api/#template)选项。
++ 不支持使用[`x-templates`](https://cn.vuejs.org/v2/guide/components.html#X-Templates).
++ 不支持使用[`Vue.compile`](https://cn.vuejs.org/v2/api/#Vue-compile).
+
+## 平台的差异
+
+Vue.js最初是为Web平台设计的。虽然可以基于Weex开发原生应用程序,但是仍然存在许多[Weex 与 Web 平台的差异](../wiki/platform-difference.html)。
+
+与 Web 平台的主要差异是: 上下文、DOM、样式和事件。
+
+### 上下文
+Weex主要用于编写多页的应用程序,每一页相当于原生开发中的 *View* 或者 *Activity*,并且它有着自己的上下文。尤其`Vue`实例在每个页面都是不同的,甚至Vue的"全局"配置(`Vue.config.xxx`)也只会影响Weex上的单个页面。
+
+在此基础上,一些Vue的SPA(单页面应用)技术,如[Vuex](https://vuex.vuejs.org/zh-cn/)和[vue-router](https://router.vuejs.org/zh-cn/)也将单页内生效。更通俗地说,“页面”概念在SPA技术中是虚拟的,但在Weex上却是真实的。
+
+无论如何,Vuex和vue-路由器都是独立的库,它们都有自己的概念和使用场景,你仍然可以在Weex里[使用Vuex和vue-router](./advanced/use-vuex-and-vue-router.html)。
+
+### DOM
+
+因为在Android和iOS上没有DOM(document object mode),如果你要手动操作和生成DOM元素的话可能会遇到一些兼容性问题。在你使用现代前端框架的情况下,操作数据与组件而不是生成的元素是一个比较好的做法。
--- End diff --
Document Object Model
---
[GitHub] incubator-weex-site issue #46: 1.��������������� ��� Weex ��������� Vue.js 2...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on the issue:
https://github.com/apache/incubator-weex-site/pull/46
I think you should rebase and modify the commit log to English, then force update the branch. Or I will do it before merge, but your author information would be lost and this PR will show as *closed*.
---
[GitHub] incubator-weex-site issue #46: 1.��������������� ��� Weex ��������� Vue.js 2...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on the issue:
https://github.com/apache/incubator-weex-site/pull/46
No need to open a new PR, I can squash and modify the commit log before merging. Moreover, you can also force update your `use-vue-branch` branch to modify them.
---
[GitHub] incubator-weex-site issue #46: 1.��������������� ��� Weex ��������� Vue.js 2...
Posted by 1xuanyuan1 <gi...@git.apache.org>.
Github user 1xuanyuan1 commented on the issue:
https://github.com/apache/incubator-weex-site/pull/46
I'm so sorry! Please check #44 and #46. If the submitted content is ok. I will close them and commit new pull requests.
---
[GitHub] incubator-weex-site pull request #46: 1.��������������� ��� Weex ��������� V...
Posted by Hanks10100 <gi...@git.apache.org>.
Github user Hanks10100 commented on a diff in the pull request:
https://github.com/apache/incubator-weex-site/pull/46#discussion_r163442514
--- Diff: source/cn/guide/use-vue.md ---
@@ -5,7 +5,280 @@ group: Overview
order: 1.6
version: 2.1
---
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
-Working in progress.
+自2016年2月17日发布WeexSDK [v0.10.0](https://github.com/alibaba/weex/releases/tag/v0.10.0)后,Weex集成了v2版本的Vue。Vue(读音 /vjuː/,类似于 view 的读音)是一套构建用户界面(user interface)的渐进式框架。详情请参阅其[官方网站](https://cn.vuejs.org/)。
--- End diff --
Please use Chinese punctuations. Use `,` and `。` instead of `,` and `.`.
By the way, I think it's a good practice to add a space between Chinese words and English words. Such as `Weex 集成了 v2 版本的 Vue。`
As well as the follow-up paragraphs.
---