Closed ozee31 closed 7 years ago
If you want to run it in html file, pls try like this:
<body>
<vue-markdown>i am a ~~tast~~ **test**.</vue-markdown>
</body>
<script src="path/to/vue.js"></script>
<script src="path/to/vue-markdown.js"></script>
<script>
Vue.use(VueMarkdown);
var vm = new Vue({
el: "body"
});
</script>
There is also an example script in html file.
If you want to run it in ES6 javascript file, pls try like this:
import VueMarkdown from 'vue-markdown'
export default {
components: {
VueMarkdown
}
}
:)
I run vuejs 2.0 with ES6 in a .vue file.
with
import VueMarkdown from 'vue-markdown'
export default {
components: {
VueMarkdown
}
}
Markdown is not converted but not have erros in console
And if i try:
<template>
<vue-markdown :source="mkd"></vue-markdown>
</template>
<script>
import VueMarkdown from 'vue-markdown'
export default {
components: {
VueMarkdown
},
data () {
return {
mkd: '# h1 Heading'
}
},
}
</script>
Output is empty (just a blank div)
Got it! I'll check it soon.
It's an incompatibility with vuejs 2.0
For exemple ready
replaced by mounted
i have the same problem ,it's not work on vuejs 2.0
waiting replace ready
by mounted
. It's work but there are warnings (deprecated comportment)
@ozee31 i can not totally understand your words, can you post your worked code if you are convenience ? thanks
in VueMarkdown.js
replace
ready() {
if (this.$el.childNodes.length > 0) {
this._source = ''
for (let el of this.$el.childNodes) {
const ext = el.outerHTML ? el.outerHTML : el.textContent
this._source += ext
}
}
rende(this)
this.$watch('source', () => { rende(this) })
this.watches.forEach((v) => {
this.$watch(v, () => { rende(this) })
})
}
by
mounted() {
if (this.$el.childNodes.length > 0) {
this._source = ''
for (let el of this.$el.childNodes) {
const ext = el.outerHTML ? el.outerHTML : el.textContent
this._source += ext
}
}
rende(this)
this.$watch('source', () => { rende(this) })
this.watches.forEach((v) => {
this.$watch(v, () => { rende(this) })
})
}
I tried it just now and there is some problems. I'm wormking to fix this...
yes many warning
@ozee31 Is it ok right now ?
ok it's work. Think you
Hi,
I try to generate markdown but does'nt work:
output is:
i am a ~~tast~~ **test**.
in a<div>