sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.79k stars 1.12k forks source link

How to integrate SimpleMDE into Nuxt.js? #821

Open XinwenCheng opened 2 years ago

XinwenCheng commented 2 years ago

Hi,

I'm trying to use SimpleMDE in my Nuxt.js project, but I couldn't make it yet. It would be very appreciated if anyone could share some successful experiences.

Firstly, I installed SimpleMDE by npm i simplemde --save, and then created a js file named simple_mde.js under ~/plugins folder with the following content:

import Vue from "vue";
import SimpleMDE from "simplemde";

// Vue.component("SimpleMDE", SimpleMDE); // I tried this line either.
Vue.use(SimpleMDE);

And then registered this plugin in nuxt.config.js:

  plugins: [
    { src: "~/plugins/simple_mde.js" }
  ],

So, I thought I could use the plugin on the page, here's the code:

<script></script>

<template>
  <div>
    <simplemde />
  </div>
</template>

But I failed with the following error, no clue, and didn't find out any solution for this, could anyone help? Thanks in advance! Screen Shot 2021-09-14 at 19 16 53

BTW, before I integrated SimpleMDE, there's no such error, my website runs correctly.