@@ -77,7 +77,7 @@ type: api
77
77
78
78
指定组件的渲染和观察期间未捕获错误的处理函数。这个处理函数被调用时,可获取错误信息和 Vue 实例。
79
79
80
- > [ Sentry] ( https://sentry.io ) , an error tracking service, provides [ official integration ] ( https://sentry.io/for/vue/ ) using this option.
80
+ > [ Sentry] ( https://sentry.io ) , 一个错误追踪服务, 通过此选项提供 [ 官方集成 ] ( https://sentry.io/for/vue/ ) 。
81
81
82
82
### ignoredElements
83
83
@@ -563,7 +563,11 @@ type: api
563
563
564
564
<p class =" tip " > 提供的元素只能作为挂载点。不同于 Vue 1.x,所有的挂载元素会被 Vue 生成的 DOM 替换。因此不推荐挂载root实例到 `<html >` 或者 `<body >` 上。</p >
565
565
566
- - ** 参考:** [ 生命周期图示] ( ../guide/instance.html#生命周期图示 )
566
+ <p class =" tip " >如果 `render` 函数和 `template` 属性都不存在,挂载 DOM 元素的 HTML 会被提取出来用作模板,此时,必须使用 Runtime + Compiler 构建的 Vue 库。</p >
567
+
568
+ - ** 参考:**
569
+ - [ 生命周期图示] ( ../guide/instance.html#生命周期图示 )
570
+ - [ 独立构建-vs-运行时构建] ( ../guide/installation.html#独立构建-vs-运行时构建 )
567
571
568
572
### template
569
573
@@ -577,6 +581,8 @@ type: api
577
581
578
582
<p class =" tip " >出于安全考虑,您应该只使用您信任的 Vue 模板。避免使用其他人生成的内容作为您的模板。</p >
579
583
584
+ <p class =" tip " >如果 Vue 选项中包含 render 函数,template 选项将被忽略。</p >
585
+
580
586
- ** 参考:**
581
587
- [ 生命周期图示] ( ../guide/instance.html#生命周期图示 )
582
588
- [ 内容分发] ( ../guide/components.html#使用-Slot-分发内容 )
@@ -591,6 +597,8 @@ type: api
591
597
592
598
如果组件是一个函数组件,Render 函数还会接收一个额外的 ` context ` 参数,为没有实例的函数组件提供上下文信息。
593
599
600
+ <p class =" tip " >Vue 选项中的 `render` 函数若存在,则 Vue 构造函数不会从 `template` 选项或通过 `el` 选项指定的挂载元素中提取出的 HTML 模板编译 render 函数。</p >
601
+
594
602
- ** 参考:**
595
603
- [ Render 函数] ( ../guide/render-function.html )
596
604
@@ -994,9 +1002,9 @@ type: api
994
1002
995
1003
- ** 详细:**
996
1004
997
- Used to programmatically access [ scoped slots] ( ../guide/components.html#Scoped-Slots ) . For each slot, including the ` default ` one, the object contains a corresponding function that returns VNodes.
998
-
999
- Accessing ` vm.$scopedSlots ` is most useful when writing a component with a [ render function ] ( ../guide/render-function.html ) .
1005
+ 用来访问 [ scoped slots] ( ../guide/components.html#Scoped-Slots ) 。对于包括 ` 默认 slot` 在内的每一个 slot, 该对象都包含一个返回相应 VNode 的函数。
1006
+
1007
+ 在使用 [ render 函数 ] ( ../guide/render-function.html ) 书写一个组件时,访问 ` vm.$scopedSlots ` 最有帮助。
1000
1008
1001
1009
- ** 参考:**
1002
1010
- [ ` <slot> ` 组件] ( #slot-1 )
@@ -1365,13 +1373,13 @@ type: api
1365
1373
1366
1374
> 2.1.0新增
1367
1375
1368
- - ** Expects :** ` any `
1376
+ - ** 类型 :** ` any `
1369
1377
1370
- - ** Restriction :** previous sibling element must have ` v-if ` or ` v-else-if ` .
1378
+ - ** 限制 :** 前一兄弟元素必须有 ` v-if ` 或 ` v-else-if ` 。
1371
1379
1372
- - ** Usage :**
1380
+ - ** 用法 :**
1373
1381
1374
- Denote the "else if block" for ` v-if ` . Can be chained.
1382
+ 表示 ` v-if ` 的 "else if 块"。可以链式调用。
1375
1383
1376
1384
``` html
1377
1385
<div v-if =" type === 'A'" >
@@ -1388,7 +1396,7 @@ type: api
1388
1396
</div >
1389
1397
```
1390
1398
1391
- - ** See also :** [ 条件渲染 - v-else-if] ( ../guide/conditional.html#v-else-if )
1399
+ - ** 参考 :** [ 条件渲染 - v-else-if] ( ../guide/conditional.html#v-else-if )
1392
1400
1393
1401
### v-for
1394
1402
@@ -1553,13 +1561,13 @@ type: api
1553
1561
<svg ><a :xlink:special =" foo" ></a ></svg >
1554
1562
```
1555
1563
1556
- The ` .camel ` modifier allows camelizing a ` v-bind ` attribute name when using in-DOM templates, e.g. the SVG ` viewBox ` attribute:
1564
+ ` .camel ` 修饰符允许在使用 DOM 模板时将 ` v-bind ` 属性名称驼峰化,例如 SVG 的 ` viewBox ` 属性:
1557
1565
1558
1566
``` html
1559
1567
<svg :view-box.camel =" viewBox" ></svg >
1560
1568
```
1561
1569
1562
- ` .camel ` is not needed if you are using string templates, or compiling with ` vue-loader ` /` vueify ` .
1570
+ 在使用字符串模板或通过 ` vue-loader ` /` vueify ` 编译时,无需使用 ` .camel ` 。
1563
1571
1564
1572
- ** 参考:**
1565
1573
- [ Class 与 Style 绑定] ( ../guide/class-and-style.html )
@@ -1833,8 +1841,8 @@ type: api
1833
1841
### keep-alive
1834
1842
1835
1843
- ** Props:**
1836
- - ` include ` - string or RegExp. Only components matched by this will be cached.
1837
- - ` exclude ` - string or RegExp. Any component matched by this will not be cached.
1844
+ - ` include ` - 字符串或正则表达式。只有匹配的组件会被缓存。
1845
+ - ` exclude ` - 字符串或正则表达式。任何匹配的组件都不会被缓存。
1838
1846
1839
1847
- ** 用法:**
1840
1848
@@ -1866,23 +1874,23 @@ type: api
1866
1874
1867
1875
- ** ` include ` and ` exclude ` **
1868
1876
1869
- > New in 2.1.0
1877
+ > 2.1.0 新增
1870
1878
1871
- The ` include ` and ` exclude ` props allow components to be conditionally cached. Both props can either be a comma-delimited string or a RegExp :
1879
+ ` include ` 和 ` exclude ` 属性允许组件有条件地缓存。二者都可以用逗号分隔字符串或正则表达式来表示 :
1872
1880
1873
1881
``` html
1874
- <!-- comma-delimited string -->
1882
+ <!-- 逗号分隔字符串 -->
1875
1883
<keep-alive include =" a,b" >
1876
1884
<component :is =" view" ></component >
1877
1885
</keep-alive >
1878
1886
1879
- <!-- regex (use v-bind) -->
1887
+ <!-- 正则表达式 (使用 v-bind) -->
1880
1888
<keep-alive :include =" /a|b/" >
1881
1889
<component :is =" view" ></component >
1882
1890
</keep-alive >
1883
1891
```
1884
1892
1885
- The match is first checked on the component's own ` name ` option, then its local registration name (the key in the parent's ` components ` option) if the ` name ` option is not available. Anonymous components cannot be matched against.
1893
+ 匹配首先检查组件自身的 ` name ` 选项,如果 ` name ` 选项不可用,则匹配它的局部注册名称(父组件 ` components ` 选项的键值)。匿名组件不能被匹配。
1886
1894
1887
1895
<p class =" tip " >`<keep-alive >` 不会在函数式组件中正常工作,因为它们没有缓存实例。</p >
1888
1896
0 commit comments