From d9db45c287c64bce20f0d9772da836114c2bafab Mon Sep 17 00:00:00 2001 From: Dmitry Molotkov Date: Wed, 20 Mar 2019 19:50:23 +0300 Subject: [PATCH] chore(examples): fix dynamic components example (#5294) --- examples/dynamic-components/components/chart.js | 17 +++++++---------- examples/dynamic-components/package.json | 4 ++-- examples/dynamic-components/pages/index.vue | 2 +- examples/dynamic-components/pages/ssr.vue | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/examples/dynamic-components/components/chart.js b/examples/dynamic-components/components/chart.js index cb9f40a018..fa668cd2ec 100644 --- a/examples/dynamic-components/components/chart.js +++ b/examples/dynamic-components/components/chart.js @@ -1,12 +1,9 @@ -let VueChart = import('vue-chartjs' /* webpackChunkName: "vue-chartjs" */) +import { Bar } from 'vue-chartjs' -export default async () => { - VueChart = await VueChart - - return VueChart.Bar.extend({ - props: ['data'], - mounted() { - this.renderChart(this.data) - } - }) +export default { + extends: Bar, + props: ['data'], + mounted() { + this.renderChart(this.data) + } } diff --git a/examples/dynamic-components/package.json b/examples/dynamic-components/package.json index 0839a6bbfc..0fb7f11c8f 100644 --- a/examples/dynamic-components/package.json +++ b/examples/dynamic-components/package.json @@ -1,9 +1,9 @@ { "name": "example-dynamic-components", "dependencies": { - "chart.js": "^2.7.0", + "chart.js": "^2.7.3", "nuxt": "latest", - "vue-chartjs": "^2.8.7" + "vue-chartjs": "^3.4.2" }, "scripts": { "dev": "nuxt", diff --git a/examples/dynamic-components/pages/index.vue b/examples/dynamic-components/pages/index.vue index 87fe2e7df0..b1ef831c1f 100755 --- a/examples/dynamic-components/pages/index.vue +++ b/examples/dynamic-components/pages/index.vue @@ -16,7 +16,7 @@ const components = { vText: () => import('@/components/text.vue' /* webpackChunkName: "components/text" */), vImage: () => import('@/components/image.vue' /* webpackChunkName: "components/image" */), vCode: () => import('@/components/code.vue' /* webpackChunkName: "components/code" */), - vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */).then(m => m.default()) + vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */) } export default { diff --git a/examples/dynamic-components/pages/ssr.vue b/examples/dynamic-components/pages/ssr.vue index 8ed67f6296..2f72661b5d 100644 --- a/examples/dynamic-components/pages/ssr.vue +++ b/examples/dynamic-components/pages/ssr.vue @@ -17,7 +17,7 @@ const components = { vText: () => import('@/components/text.vue' /* webpackChunkName: "components/text" */), vImage: () => import('@/components/image.vue' /* webpackChunkName: "components/image" */), vCode: () => import('@/components/code.vue' /* webpackChunkName: "components/code" */), - vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */).then(m => m.default()) + vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */) } export default {