mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-09 03:03:18 +00:00
Mixins and Vue.extend possible
This commit is contained in:
parent
d4b8bc4f02
commit
e48f8250a0
@ -14,8 +14,13 @@ function loadAsyncComponents (to, ___, next) {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const _resolve = (Component) => {
|
const _resolve = (Component) => {
|
||||||
// console.log('Component loaded', Component, match.path, key)
|
// console.log('Component loaded', Component, match.path, key)
|
||||||
Component = Vue.extend(Component) // fix issue #6
|
if (!Component.options) {
|
||||||
Component._Ctor = Component
|
Component = Vue.extend(Component) // fix issue #6
|
||||||
|
Component._Ctor = Component
|
||||||
|
} else {
|
||||||
|
Component._Ctor = Component
|
||||||
|
Component.extendOptions = Component.options
|
||||||
|
}
|
||||||
match.components[key] = Component
|
match.components[key] = Component
|
||||||
resolve(Component)
|
resolve(Component)
|
||||||
}
|
}
|
||||||
@ -169,8 +174,13 @@ const resolveComponents = flatMapComponents(router.match(path), (Component, _, m
|
|||||||
if (typeof Component === 'function' && !Component.options) {
|
if (typeof Component === 'function' && !Component.options) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const _resolve = (Component) => {
|
const _resolve = (Component) => {
|
||||||
Component = Vue.extend(Component) // fix issue #6
|
if (!Component.options) {
|
||||||
Component._Ctor = Component
|
Component = Vue.extend(Component) // fix issue #6
|
||||||
|
Component._Ctor = Component
|
||||||
|
} else {
|
||||||
|
Component._Ctor = Component
|
||||||
|
Component.extendOptions = Component.options
|
||||||
|
}
|
||||||
if (Component.options.data && typeof Component.options.data === 'function') {
|
if (Component.options.data && typeof Component.options.data === 'function') {
|
||||||
Component._data = Component.options.data
|
Component._data = Component.options.data
|
||||||
if (NUXT.serverRendered) {
|
if (NUXT.serverRendered) {
|
||||||
|
@ -64,6 +64,9 @@ export default context => {
|
|||||||
if (!Component.options) {
|
if (!Component.options) {
|
||||||
Component = Vue.extend(Component)
|
Component = Vue.extend(Component)
|
||||||
Component._Ctor = Component
|
Component._Ctor = Component
|
||||||
|
} else {
|
||||||
|
Component._Ctor = Component
|
||||||
|
Component.extendOptions = Component.options
|
||||||
}
|
}
|
||||||
if (Component.options.data && typeof Component.options.data === 'function') {
|
if (Component.options.data && typeof Component.options.data === 'function') {
|
||||||
Component._data = Component.options.data
|
Component._data = Component.options.data
|
||||||
|
@ -69,7 +69,6 @@ module.exports = function () {
|
|||||||
},
|
},
|
||||||
plugins: this.options.build.plugins
|
plugins: this.options.build.plugins
|
||||||
}
|
}
|
||||||
console.log(config.module.rules[1])
|
|
||||||
// Add nuxt build loaders (can be configured in nuxt.config.js)
|
// Add nuxt build loaders (can be configured in nuxt.config.js)
|
||||||
config.module.rules = config.module.rules.concat(this.options.build.loaders)
|
config.module.rules = config.module.rules.concat(this.options.build.loaders)
|
||||||
// Return config
|
// Return config
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nuxt",
|
"name": "nuxt",
|
||||||
"version": "0.4.9",
|
"version": "0.5.0",
|
||||||
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
|
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user