code-farmer-i / vue-markdown-editor

A markdown editor built on Vue
https://code-farmer-i.github.io/vue-markdown-editor/
MIT License
1.08k stars 110 forks source link

before-preview-change 属性无效 #157

Closed tech-xs closed 2 years ago

tech-xs commented 2 years ago

before-preview-change函数不执行

<template>
  <Mgr>
    <v-md-preview
        ref="md"
        :text="mdText"
        :before-preview-change="change"/>
  </Mgr>
</template>

<script>
import Mgr from '@/components/mgr/Mgr'
import {getDocContent} from "@/api/doc/doc";

export default {
  name: "WebDoc",
  components: {Mgr},
  data() {
    return {
      mdText: ''
    }
  },
  created() {
    let resource = this.$route.query.resource
    getDocContent(resource).then(res => {
      this.mdText = res
    })
  },
  methods: {
    change(text, next) {
      console.log(this.$refs.md)
      console.log(text)
      console.log(next)
      // next()
    }
  }
}
</script>
<style lang="less" scoped>
.body {
  margin-left: 50px;
  margin-right: 50px;
}
</style>
code-farmer-i commented 2 years ago

preview 组件使用 before-change