SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.     <n-module type="demo">
  3.         <div slot="header" class="demo">
  4.             <component :is="`demos-${name}`"/>
  5.         </div>
  6.  
  7.         <div class="code">
  8.             <codemirror :value="raw" :options="cmOptions"></codemirror>
  9.         </div>
  10.     </n-module>
  11. </template>
  12.  
  13. <script>
  14. import 'codemirror/mode/htmlmixed/htmlmixed.js';
  15. import 'codemirror/mode/vue/vue.js';
  16.  
  17. export default {
  18.     name: 'Demo',
  19.  
  20.     props: {
  21.         name: {
  22.             type: String,
  23.             required: true,
  24.         },
  25.     },
  26.  
  27.     data () {
  28.         return {
  29.             raw: '',
  30.             component: null,
  31.             cmOptions: {
  32.                 tabSize: 4,
  33.                 mode: 'text/x-vue',
  34.                 theme: 'noah',
  35.                 lineNumbers: true,
  36.                 lineWrapping: true,
  37.                 line: true,
  38.                 readOnly: true,
  39.             },
  40.         };
  41.     },
  42.  
  43.     mounted () {
  44.         this.raw = require(`!!raw-loader!./demos/${this.name}.vue`).default;
  45.     },
  46. };
  47. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top