Issue #2465💬 AnsweredOpened December 23, 2019by raghuv91 reactions

Issue with css and icons

快速解答by pouyamiralayi1

@raghuv9 creating a custom vue component for grapesjs: and to actually use it: check this repo for more info. cheers!

Read full answer below ↓

Question

代码片段TEXT
hey @artf i installed grapes js through npm [ "grapesjs": "^0.15.9"] and i'm using vue with grapes js , here is my code
------------------------------------------------------------------------------------------------------------                                                                                                  
import grapesjs from 'grapesjs';
import 'grapesjs/dist/css/grapes.min.css';
export default {
        data() {
            return {
                editor: null
            }
        },
        methods: {
            change() {
                this.$emit('change', this.editor.getHtml());
            },
        },
        mounted() {
            this.editor = grapesjs.init({
                container : '#gjs'
            })
            this.editor.on('change', this.change);
        }
    }
i'm having issues with css as few icons are missing and remaining  icons are not responding to any action. and there are no errors when i run npm and no errors in the browser console too.
os-windows10 , node-13.0.1,npm:6.13.0

**This how my ui looks like**
![Screenshot_11](https://user-images.githubusercontent.com/26516842/71341208-3c3e1f80-257f-11ea-8b1e-5366df82d921.png)

Answers (1)

pouyamiralayiDecember 23, 2019

@raghuv9 creating a custom vue component for grapesjs:

import grapesjs from 'grapesjs'

const VueGrapesjs = {
  install (Vue, options = {}) {
    const config = {
      presets: []
    }

    const { presets } = Object.assign(config, options)

    if (presets.length) {
      presets.forEach((data) => {
        const {
          name,
          options = {},
          loader
        } = data

        grapesjs.plugins.add(name, (editor) => {
          loader(editor, options)
        })
      })
    }

    Vue.prototype.$grapesjs = grapesjs
  }
}

export default VueGrapesjs

and to actually use it:

<template>
  <div id="app">
    <grapesjs
      :options="gjsConfigs"
    />
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {
      gjsConfigs: {
        plugins: ['charts']
      }
    }
  }
}
</script>

check this repo for more info. cheers!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.