Commit e2c5a5d3 authored by Jinjiang's avatar Jinjiang

[docs][zh] translated options.md

parent 6dcaf02a
...@@ -68,7 +68,7 @@ module.exports = { ...@@ -68,7 +68,7 @@ module.exports = {
link: '/zh/spec.html' link: '/zh/spec.html'
}, },
{ {
text: '选项手册', text: '选项参考',
link: '/zh/options.html' link: '/zh/options.html'
}, },
{ {
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
sidebar: auto sidebar: auto
--- ---
# Options Reference # 选项参考
## transformAssetUrls ## transformAssetUrls
- type: `{ [tag: string]: string | Array<string> }` - 类型:`{ [tag: string]: string | Array<string> }`
- default: - 默认值:
``` js ``` js
{ {
...@@ -18,52 +18,52 @@ sidebar: auto ...@@ -18,52 +18,52 @@ sidebar: auto
} }
``` ```
During template compilation, the compiler can transform certain attributes, such as `src` URLs, into `require` calls, so that the target asset can be handled by webpack. For example, `<img src="./foo.png">` will attempt to locate the file `./foo.png` on your file system and include it as a dependency of your bundle. 在模板编译过程中,编译器可以将某些特性转换为 `require` 调用,例如 `src` 中的 URL。因此这些目标资源可以被 webpack 处理。例如 `<img src="./foo.png">` 会找到你文件系统中的 `./foo.png` 并将其作为一个依赖包含在你的包里。
## compiler ## compiler
- Type: `VueTemplateCompiler` - 类型:`VueTemplateCompiler`
- default: `require('vue-template-compiler')` - 默认值:`require('vue-template-compiler')`
Override the default compiler used to compile `<template>` blocks in single file components. 覆写用来编译单文件组件中 `<template>` 块的默认编译器。
## compilerOptions ## compilerOptions
- type: `Object` - 类型:`Object`
- default: `{}` - 默认值:`{}`
Options for the template compiler. When using the default `vue-template-compiler`, you can use this option to add custom compiler directives, modules, or discard whitespaces between template tags with `{ preserveWhitespace: false }`. 模板编译器的选项。当使用默认的 `vue-template-compiler` 的时候,你可以使用这个选项来添加自定义编译器指令、模块或通过 `{ preserveWhitespace: false }` 放弃模板标签之间的空格。
See [`vue-template-compiler` options reference](https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#options). 详情查阅 [`vue-template-compiler` 选项参考](https://github.com/vuejs/vue-docs-zh-cn/blob/master/vue-template-compiler/README.md#选项).
## transpileOptions ## transpileOptions
- type: `Object` - 类型:`Object`
- default: `{}` - 默认值:`{}`
Configure ES2015+ to ES5 transpiling options for the generated render function code. The [transpiler](https://github.com/vuejs/vue-template-es2015-compiler) is a fork of [Buble](https://github.com/Rich-Harris/buble), so consult the available options [here](https://buble.surge.sh/guide/#using-the-javascript-api). 为渲染函数的生成码配置从 ES2015+ 到 ES5 的转译选项。这里的[转译器](https://github.com/vuejs/vue-template-es2015-compiler)是一份 [Buble](https://github.com/Rich-Harris/buble) 的 fork,因此你可以在[这里](https://buble.surge.sh/guide/#using-the-javascript-api)咨询可用的选项。
The template render functions compilation supports a special transform `stripWith` (enabled by default), which removes the `with` usage in generated render functions to make them strict-mode compliant. This is enabled by default. 模板渲染函数编译支持一个特殊的变换 `stripWith` (默认启用),它删除生成的渲染函数中的 `with` 用法,使它们兼容严格模式。
## optimizeSSR ## optimizeSSR
- type: `boolean` - 类型:`boolean`
- default: `true` when the webpack config has `target: 'node'` and `vue-template-compiler` is at version 2.4.0 or above. - 默认值:当 webpack 配置中包含 `target: 'node'``vue-template-compiler` 版本号大于等于 2.4.0 时为 `true`
Enable Vue 2.4 SSR compilation optimization that compiles part of the vdom trees returned by render functions into plain strings, which improves SSR performance. In some cases you might want to explicitly turn it off because the resulting render functions can only be used for SSR and cannot be used for client-side rendering or testing. 开启 Vue 2.4 服务端渲染的编译优化之后,渲染函数将会把返回的 vdom 树的一部分编译为字符串,以提升服务端渲染的性能。在一些情况下,你可能想要明确的将其关掉,因为该渲染函数只能用于服务端渲染,而不能用于客户端渲染或测试环境。
## hotReload ## hotReload
- type: `boolean` - 类型:`boolean`
- default: `true` in development mode, `false` in production mode or when the webpack config has `target: 'node'`. - 默认值:在开发环境下是 `true`,在生产环境下或 webpack 配置中有 `target: 'node'` 的时候是 `false`
- allowed value: `false` (`true` will not force Hot Reload neither in production mode nor when `target: 'node'`) - 允许的值:`false` (`true` 会强制热重载,即便是生产环境或 `target: 'node'`)
Whether to use webpack [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/) to apply changes in the browser **without reloading the page**. 是否使用 webpack 的[模块热替换](https://webpack.js.org/concepts/hot-module-replacement/)在浏览器中应用变更而**不重载整个页面**
Use this option (value `false`) to disable the Hot Reload feature in development mode. 用这个选项 (值设为 `false`) 在开发环境下关闭热重载特性。
## productionMode ## productionMode
- type: `boolean` - 类型:`boolean`
- default: `process.env.NODE_ENV === 'production'` - 默认值:`process.env.NODE_ENV === 'production'`
Force production mode, which prohibits the loader from emitting code (e.g. hot-reload related code) that is development-only. 强制指定为生产环境,即禁止 loader 注入只在开发环境有效的代码 (例如 hot-reload 相关的代码)。
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment