You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates an application instance. Expects the root component as the first argument, and optional props to be passed to the root component as the second argument.
5
+
Creates an application instance.
6
6
7
7
-**Type**
8
8
9
9
```ts
10
10
function createApp(rootComponent:Component, rootProps?:object):App
Ifthecomponenthasatemplateorarenderfunction defined, it will replace any existing DOM nodes inside the container. Otherwise, if the runtime compiler is available, the `innerHTML` of the container will be used as the template.
Ifthecomponenthasatemplateorarenderfunction defined, it will replace any existing DOM nodes inside the container. Otherwise, if the runtime compiler is available, the `innerHTML` of the container will be used as the template.
Theplugincaneitherbeanobjectwithan`install()`method, oradirectlyafunction (whichitselfwillusedastheinstallmethod). The options (secondargumentof`app.use()`) will be passed along to the plugin's install method.
Theplugincaneitherbeanobjectwithan`install()`method, oradirectlyafunction (whichitselfwillusedastheinstallmethod). The options (secondargumentof`app.use()`) will be passed along to the plugin's install method.
@@ -383,12 +407,16 @@ This config option is only respected when using the full build (i.e. the standal
383
407
384
408
### app.compilerOptions.isCustomElement
385
409
386
-
Specifies a check method to recognize native custom elements. If a tag name matches this condition, Vue will render it as a native element instead of attempting to resolve it as a Vue component.
387
-
388
-
Native HTML and SVG tags don't need to be matched in this function - Vue's parser recognizes them automatically.
410
+
Specifies a check method to recognize native custom elements.
389
411
390
412
- **Type:** `(tag: string) => boolean`
391
413
414
+
- **Details**
415
+
416
+
Should return `true` if the tag should be treated as a native custom element. For a matched tag, Vue will render it as a native element instead of attempting to resolve it as a Vue component.
417
+
418
+
Native HTML and SVG tags don't need to be matched in this function - Vue's parser recognizes them automatically.
419
+
392
420
- **Example**
393
421
394
422
```js
@@ -404,17 +432,19 @@ Native HTML and SVG tags don't need to be matched in this function - Vue's parse
404
432
405
433
Adjusts template whitespace handling behavior.
406
434
407
-
Vue removes / condenses whitespaces in templates to produce more efficient compiled output. The default strategy is "condense", with the following behavior:
435
+
- **Type:** `'condense'|'preserve'`
408
436
409
-
1. Leading / ending whitespaces inside an element are condensed into a single space.
410
-
2. Whitespaces between elements that contain newlines are removed.
411
-
3. Consecutive whitespaces in text nodes are condensed into a single space.
437
+
- **Default:** `'condense'`
412
438
413
-
Setting this option to `'preserve'` will disable (2) and (3).
439
+
- **Details**
414
440
415
-
- **Type:** `'condense'|'preserve'`
441
+
Vue removes / condenses whitespaces in templates to produce more efficient compiled output. The default strategy is "condense", with the following behavior:
416
442
417
-
- **Default:** `'condense'`
443
+
1. Leading / ending whitespaces inside an element are condensed into a single space.
444
+
2. Whitespaces between elements that contain newlines are removed.
445
+
3. Consecutive whitespaces in text nodes are condensed into a single space.
446
+
447
+
Setting this option to `'preserve'` will disable (2) and (3).
418
448
419
449
- **Example**
420
450
@@ -424,12 +454,16 @@ Setting this option to `'preserve'` will disable (2) and (3).
424
454
425
455
### app.compilerOptions.delimiters
426
456
427
-
Adjusts the delimiters used for text interpolation within the template. This is typically used to avoid conflicting with server-side frameworks that also use mustache syntax.
457
+
Adjusts the delimiters used for text interpolation within the template.
This is typically used to avoid conflicting with server-side frameworks that also use mustache syntax.
466
+
433
467
- **Example**
434
468
435
469
```js
@@ -441,12 +475,14 @@ Adjusts the delimiters used for text interpolation within the template. This is
441
475
442
476
Adjusts treatment of HTML comments in templates.
443
477
444
-
By default, Vue will remove the comments in production. Setting this option to `true` will force Vue to preserve comments even in production. Comments are always preserved during development. This option is typically used when Vue is used with other libraries that rely on HTML comments.
445
-
446
478
- **Type:** `boolean`
447
479
448
480
- **Default:** `false`
449
481
482
+
- **Details**
483
+
484
+
By default, Vue will remove the comments in production. Setting this option to `true` will force Vue to preserve comments even in production. Comments are always preserved during development. This option is typically used when Vue is used with other libraries that rely on HTML comments.
485
+
450
486
- **Example**
451
487
452
488
```js
@@ -455,9 +491,7 @@ By default, Vue will remove the comments in production. Setting this option to `
455
491
456
492
## app.config.globalProperties
457
493
458
-
An object that can be used to register global properties that can be accessed on any component instance inside the application. This is a replacement of Vue 2's `Vue.prototype` which is no longer present in Vue 3. As with anything global, this should be used sparingly.
459
-
460
-
If a global property conflicts with a component’s own property, the component's own property will have higher priority.
494
+
An object that can be used to register global properties that can be accessed on any component instance inside the application.
461
495
462
496
- **Type**
463
497
@@ -467,6 +501,12 @@ If a global property conflicts with a component’s own property, the component'
467
501
}
468
502
```
469
503
504
+
- **Details**
505
+
506
+
This is a replacement of Vue 2's `Vue.prototype` which is no longer present in Vue 3. As with anything global, this should be used sparingly.
507
+
508
+
If a global property conflicts with a component’s own property, the component's own property will have higher priority.
509
+
470
510
- **Usage**
471
511
472
512
```js
@@ -487,8 +527,6 @@ If a global property conflicts with a component’s own property, the component'
487
527
488
528
An object for defining merging strategies for custom component options.
489
529
490
-
The merge strategy receives the value of that option defined on the parent and child instances as the first and second arguments, respectively.
491
-
492
530
- **Type**
493
531
494
532
```ts
@@ -499,6 +537,14 @@ The merge strategy receives the value of that option defined on the parent and c
Some plugins / libraries add support for custom component options (by injecting global mixins). These options may require special merging logic when the same option needs to be "merged" from multiple sources (e.g. mixins or component inheritance).
543
+
544
+
A merge strategy function can registered for a custom option by assigning it on the `app.config.optionMergeStrategies` object using the option's name as the key.
545
+
546
+
The merge strategy function receives the value of that option defined on the parent and child instances as the first and second arguments, respectively.
0 commit comments