miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.91k stars 258 forks source link

I have reference error when i use vue-markdown #82

Open loicGR opened 5 years ago

loicGR commented 5 years ago

I installed with npm i --save vue-markdown

In my code Vue Typescript I have:

<template>
   <vue-markdown>i am a ~~tast~~ **test**.</vue-markdown>
</template>

<script lang=ts>
 import {VueMarkdown} from 'vue-markdown';

  @Component({
    components: {VueMarkdown}
  })
  export default class myVue extends Vue {
}
<script>

When i run I have the message in the console ReferenceError: VueMarkdown is not defined

loicGR commented 5 years ago

Sorry, the error message is not a reference error but this one : Unknown custom element: <vue-markdown> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Can someone help me ?

colinatkins commented 5 years ago

Try this:

 @Component({
    components: { 'vue-markdown': VueMarkdown }
  })
loicGR commented 5 years ago

@loyaruarutoitsu : It does not work better. As you can see in the image below, my IDE displays 'view-markdown' in red when importing, which means it can not find this component in the node_modules directory. There is yet! So I don't understand why it does not work.

image

ponnex commented 4 years ago

it's because there's no typings for vue-markdown. npm install --save @types/vue-markdown and add "@types/vue-markdown" under types in tsconfig.js

romain130492 commented 2 years ago

@types/vue-markdown

Thanks, that works!