Closed thearabbit closed 6 years ago
Yes, I expected source="filename" to work, but it appears the string is just a text string. I am guessing we have to use axios or some other file loader to do a file load into a string, then pass that into the source attribute.
Here is quick component I came up with wrap this one:
<template>
<vue-markdown :source="mdText"></vue-markdown>
</template>
<script>
import axios from 'axios'
export default
{
name: 'md-viewer',
props: ["src"],
data: function()
{
return ({"mdText": ""});
},
mounted()
{
axios.get(this.src).then(response => {this.mdText = response.data})
}
}
</script>
<style lang="scss"></style>
Then import and call it:
<md-viewer src="file.md"></md-viewer>
Thanks for your reply. But don't understand
<md-viewer src="file.md"></md-viewer>
Now it works fine.
I base on
Meteor + Vue
.But don't work, please help me