Skip to content

Instantly share code, notes, and snippets.

@hypeJunction
Created April 13, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hypeJunction/f7fb93906ce4be87c638cd3156df1249 to your computer and use it in GitHub Desktop.
Save hypeJunction/f7fb93906ce4be87c638cd3156df1249 to your computer and use it in GitHub Desktop.
<template>
<n-module type="demo">
<div slot="header" class="demo">
<component :is="`demos-${name}`"/>
</div>
<div class="code">
<codemirror :value="raw" :options="cmOptions"></codemirror>
</div>
</n-module>
</template>
<script>
import 'codemirror/mode/htmlmixed/htmlmixed.js';
import 'codemirror/mode/vue/vue.js';
export default {
name: 'Demo',
props: {
name: {
type: String,
required: true,
},
},
data () {
return {
raw: '',
component: null,
cmOptions: {
tabSize: 4,
mode: 'text/x-vue',
theme: 'noah',
lineNumbers: true,
lineWrapping: true,
line: true,
readOnly: true,
},
};
},
mounted () {
this.raw = require(`!!raw-loader!./demos/${this.name}.vue`).default;
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment