forked from daren.hsu/line_push
update
This commit is contained in:
+13
-15
@@ -4,20 +4,19 @@
|
||||
// This module is a runtime utility for cleaner component module output and will
|
||||
// be included in the final webpack user bundle.
|
||||
|
||||
export default function normalizeComponent (
|
||||
export default function normalizeComponent(
|
||||
scriptExports,
|
||||
render,
|
||||
staticRenderFns,
|
||||
functionalTemplate,
|
||||
injectStyles,
|
||||
scopeId,
|
||||
moduleIdentifier, /* server only */
|
||||
moduleIdentifier /* server only */,
|
||||
shadowMode /* vue-cli only */
|
||||
) {
|
||||
// Vue.extend constructor export interop
|
||||
var options = typeof scriptExports === 'function'
|
||||
? scriptExports.options
|
||||
: scriptExports
|
||||
var options =
|
||||
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
||||
|
||||
// render functions
|
||||
if (render) {
|
||||
@@ -37,7 +36,8 @@ export default function normalizeComponent (
|
||||
}
|
||||
|
||||
var hook
|
||||
if (moduleIdentifier) { // server build
|
||||
if (moduleIdentifier) {
|
||||
// server build
|
||||
hook = function (context) {
|
||||
// 2.3 injection
|
||||
context =
|
||||
@@ -63,11 +63,11 @@ export default function normalizeComponent (
|
||||
} else if (injectStyles) {
|
||||
hook = shadowMode
|
||||
? function () {
|
||||
injectStyles.call(
|
||||
this,
|
||||
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
||||
)
|
||||
}
|
||||
injectStyles.call(
|
||||
this,
|
||||
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
||||
)
|
||||
}
|
||||
: injectStyles
|
||||
}
|
||||
|
||||
@@ -78,16 +78,14 @@ export default function normalizeComponent (
|
||||
options._injectStyles = hook
|
||||
// register for functional component in vue file
|
||||
var originalRender = options.render
|
||||
options.render = function renderWithStyleInjection (h, context) {
|
||||
options.render = function renderWithStyleInjection(h, context) {
|
||||
hook.call(context)
|
||||
return originalRender(h, context)
|
||||
}
|
||||
} else {
|
||||
// inject component registration as beforeCreate hook
|
||||
var existing = options.beforeCreate
|
||||
options.beforeCreate = existing
|
||||
? [].concat(existing, hook)
|
||||
: [hook]
|
||||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user