Last active
July 6, 2019 11:13
-
-
Save mhgbrown/eb3604664ed8bff5023e1b99885a4052 to your computer and use it in GitHub Desktop.
Vue, Server Side Rendering, and Handling Dependencies that Require a Browser Environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('apexchart', () => { | |
// NB: tell webpack to include the dynamic import within | |
// the main bundle instead of splitting into other bundles. | |
// https://webpack.js.org/api/module-methods/#import- | |
return import( | |
/* webpackMode: "eager" */ | |
'vue-apexcharts' | |
) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<apexchart .../> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<apexchart v-if="mounted" .../> | |
</template> | |
<script> | |
export default { | |
data () { | |
return { | |
mounted: false | |
} | |
}, | |
mounted () { | |
this.mounted = true | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment