【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

3 years ago
3 years ago
3 years ago
  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. export default {
  14. name: 'Markdown',
  15. data() {
  16. return {
  17. height: document.documentElement.clientHeight - 200 + 'px'
  18. }
  19. },
  20. computed: {
  21. ...mapGetters([
  22. 'imagesUploadApi',
  23. 'baseApi'
  24. ])
  25. },
  26. mounted() {
  27. const that = this
  28. window.onresize = function temp() {
  29. that.height = document.documentElement.clientHeight - 200 + 'px'
  30. }
  31. },
  32. methods: {
  33. imgAdd(pos, $file) {
  34. upload(this.imagesUploadApi, $file).then(res => {
  35. const data = res.data
  36. const url = this.baseApi + '/file/' + data.type + '/' + data.realName
  37. this.$refs.md.$img2Url(pos, url)
  38. })
  39. }
  40. }
  41. }
  42. </script>
  43. <style scoped>
  44. .v-note-wrapper.shadow {
  45. z-index: 5;
  46. }
  47. </style>