Rap 原分销系统代码Web
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

56 wiersze
1.2KB

  1. <template>
  2. <div class="app-container">
  3. <p class="warn-content">
  4. Markdown 基于
  5. <el-link type="primary" href="https://github.com/hinesboy/mavonEditor" target="_blank">MavonEditor</el-link>
  6. </p>
  7. <mavon-editor ref="md" :style="'height:' + height" @imgAdd="imgAdd" />
  8. </div>
  9. </template>
  10. <script>
  11. import { upload } from '@/utils/upload'
  12. import { mapGetters } from 'vuex'
  13. import { mavonEditor } from 'mavon-editor'
  14. import 'mavon-editor/dist/css/index.css'
  15. export default {
  16. name: 'Markdown',
  17. components: {
  18. mavonEditor
  19. },
  20. data() {
  21. return {
  22. height: document.documentElement.clientHeight - 200 + 'px'
  23. }
  24. },
  25. computed: {
  26. ...mapGetters([
  27. 'imagesUploadApi',
  28. 'baseApi'
  29. ])
  30. },
  31. mounted() {
  32. const that = this
  33. window.onresize = function temp() {
  34. that.height = document.documentElement.clientHeight - 200 + 'px'
  35. }
  36. },
  37. methods: {
  38. imgAdd(pos, $file) {
  39. upload(this.imagesUploadApi, $file).then(res => {
  40. const data = res.data
  41. const url = this.baseApi + '/file/' + data.type + '/' + data.realName
  42. this.$refs.md.$img2Url(pos, url)
  43. })
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped>
  49. .v-note-wrapper.shadow {
  50. z-index: 5;
  51. }
  52. </style>