How to use the vue-template-compiler/browser.parseComponent function in vue-template-compiler

To help you get started, we’ve selected a few vue-template-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spritejs / cat-charts-vue / demo / components / BlockDemo.vue View on Github external
async compile (code) {
      this.code = code
      if (!code) {
        return
      }
      const imports = []
      const { template, script, styles, customBlocks } = parseComponent(code)
      let config

      if ((config = customBlocks.find(n => n.type === 'config'))) {
        params.clear()
        params.parse(config.content)
      }

      let compiled
      const pkgs = []
      let scriptContent = 'exports = { default: {} }'
      if (script) {
        try {
          compiled = window.Babel.transform(script.content, {
            presets: ['es2015', 'es2016', 'es2017', 'stage-0'],
            plugins: [[getImports, { imports }]]
          }).code