$mount() — vue Function Reference
Architecture documentation for the $mount() function in runtime-with-compiler.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD feaee645_45c1_e2b9_4692_b11d3df632bd["$mount()"] a471e6a5_8f7e_ccbd_de6e_5b12702970c0["query()"] feaee645_45c1_e2b9_4692_b11d3df632bd -->|calls| a471e6a5_8f7e_ccbd_de6e_5b12702970c0 3849cc2d_1418_3604_f213_7a6c913ffcfd["idToTemplate()"] feaee645_45c1_e2b9_4692_b11d3df632bd -->|calls| 3849cc2d_1418_3604_f213_7a6c913ffcfd 646d1718_1954_887d_7bc9_84b5d34df6d7["getOuterHTML()"] feaee645_45c1_e2b9_4692_b11d3df632bd -->|calls| 646d1718_1954_887d_7bc9_84b5d34df6d7 1350e21f_1b74_6608_e1b6_e32c635ba3e3["mark()"] feaee645_45c1_e2b9_4692_b11d3df632bd -->|calls| 1350e21f_1b74_6608_e1b6_e32c635ba3e3 baee4b33_abd2_45c7_4cbc_98ddfcca1ce4["measure()"] feaee645_45c1_e2b9_4692_b11d3df632bd -->|calls| baee4b33_abd2_45c7_4cbc_98ddfcca1ce4 style feaee645_45c1_e2b9_4692_b11d3df632bd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/platforms/web/runtime-with-compiler.ts lines 21–92
Vue.prototype.$mount = function (
el?: string | Element,
hydrating?: boolean
): Component {
el = el && query(el)
/* istanbul ignore if */
if (el === document.body || el === document.documentElement) {
__DEV__ &&
warn(
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
)
return this
}
const options = this.$options
// resolve template/el and convert to render function
if (!options.render) {
let template = options.template
if (template) {
if (typeof template === 'string') {
if (template.charAt(0) === '#') {
template = idToTemplate(template)
/* istanbul ignore if */
if (__DEV__ && !template) {
warn(
`Template element not found or is empty: ${options.template}`,
this
)
}
}
} else if (template.nodeType) {
template = template.innerHTML
} else {
if (__DEV__) {
warn('invalid template option:' + template, this)
}
return this
}
} else if (el) {
// @ts-expect-error
template = getOuterHTML(el)
}
if (template) {
/* istanbul ignore if */
if (__DEV__ && config.performance && mark) {
mark('compile')
}
const { render, staticRenderFns } = compileToFunctions(
template,
{
outputSourceRange: __DEV__,
shouldDecodeNewlines,
shouldDecodeNewlinesForHref,
delimiters: options.delimiters,
comments: options.comments
},
this
)
options.render = render
options.staticRenderFns = staticRenderFns
/* istanbul ignore if */
if (__DEV__ && config.performance && mark) {
mark('compile end')
measure(`vue ${this._name} compile`, 'compile', 'compile end')
}
}
}
return mount.call(this, el, hydrating)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does $mount() do?
$mount() is a function in the vue codebase.
What does $mount() call?
$mount() calls 5 function(s): getOuterHTML, idToTemplate, mark, measure, query.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free