Skip to content

Commit e2016b9

Browse files
KingMariokazupon
authored andcommitted
Template declaration and render function priorities (#796)
* Template declaration and render function priorities. * Template declaration and render function priorities moved to the api document * Minor revise * Add link to builds of Vue * Move link to see also section
1 parent 68bbc5c commit e2016b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/v2/api/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,11 @@ if (version === 2) {
609609

610610
<p class="tip">The provided element merely serves as a mounting point. Unlike in Vue 1.x, the mounted element will be replaced with Vue-generated DOM in all cases. It is therefore not recommended to mount the root instance to `<html>` or `<body>`.</p>
611611

612-
- **See also:** [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
612+
<p class="tip">If neither `render` function nor `template` option is present, the in-DOM HTML of the mounting DOM element will be extracted as the template. In this case, Runtime + Compiler build of Vue should be used.</p>
613+
614+
- **See also:**
615+
- [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
616+
- [Runtime + Compiler vs. Runtime-only](../guide/installation.html#Runtime-Compiler-vs-Runtime-only)
613617

614618
### template
615619

@@ -623,6 +627,8 @@ if (version === 2) {
623627

624628
<p class="tip">From a security perspective, you should only use Vue templates that you can trust. Never use user-generated content as your template.</p>
625629

630+
<p class="tip">If render function is present in the Vue option, the template will be ignored.</p>
631+
626632
- **See also:**
627633
- [Lifecycle Diagram](../guide/instance.html#Lifecycle-Diagram)
628634
- [Content Distribution](../guide/components.html#Content-Distribution-with-Slots)
@@ -636,6 +642,8 @@ if (version === 2) {
636642
An alternative to string templates allowing you to leverage the full programmatic power of JavaScript. The render function receives a `createElement` method as it's first argument used to create `VNode`s.
637643

638644
If the component is a functional component, the render function also receives an extra argument `context`, which provides access to contextual data since functional components are instance-less.
645+
646+
<p class="tip">The `render` function has priority over the render function compiled from `template` option or in-DOM HTML template of the mounting element which is specified by the `el` option.</p>
639647

640648
- **See also:**
641649
- [Render Functions](../guide/render-function)

0 commit comments

Comments
 (0)