官网例子 markdown
请问以下报错可能是什么原因呢?
我的插件版本
{
"marked": "^0.3.6",
"lodash": "^4.16.0",
}
html
<div id="temp">
<textarea :value="inpVal" @input="inpUpdate" class="input-box"></textarea>
<div v-html="compiledMd" class="html-box"></div>
</div>
js
import _ from 'lodash';
import marked from 'marked';
export default {
name: 'temp',
data() {
return {
inpVal: '# hello',
}
},
computed: {
compiledMd: function () {
return marked(this.input, {sanitize: true})
}
},
methods: {
inpUpdate: _.debounce(function (e) {
this.inpVal = e.target.value
}, 300)
}
}
报错
注意下
this
指向问题, 没有使用箭头函数要注意this