refactor(front): 重构前端组件并优化代码
- 移除了多个无用的组件和文件 - 更新了部分组件的实现方式 - 优化了代码结构和样式 - 修复了CuteSimpleTable、CuteDragTable组件,在无数据时,数据表格不刷新问题
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<!--<p class="warn-content">-->
|
||||
<!--Markdown 基于-->
|
||||
<!--<el-link type="primary" href="https://github.com/hinesboy/mavonEditor" target="_blank">MavonEditor</el-link>-->
|
||||
<!--</p>-->
|
||||
<template>
|
||||
<mavon-editor
|
||||
ref="md"
|
||||
v-model="content"
|
||||
:style="`height: + ${height};overflow-y: hidden`"
|
||||
:ishljs="true"
|
||||
@imgAdd="imgAdd"
|
||||
@change="onChange"
|
||||
@save="onSave"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { upload } from '@/utils/upload'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mavonEditor } from 'mavon-editor'
|
||||
import 'mavon-editor/dist/css/index.css'
|
||||
const dynamicHeight = 160
|
||||
export default {
|
||||
name: 'CuteMarkdown',
|
||||
components: {
|
||||
mavonEditor
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - dynamicHeight + 'px'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'imagesUploadApi',
|
||||
'baseApi'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
const that = this
|
||||
window.onresize = () => {
|
||||
that.height = document.documentElement.clientHeight - dynamicHeight + 'px'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
imgAdd(pos, $file) {
|
||||
const that = this
|
||||
upload(that.imagesUploadApi, $file).then(res => {
|
||||
const data = res.data
|
||||
const url = that.baseApi + '/file/' + data.type + '/' + data.realName
|
||||
that.$refs.md.$img2Url(pos, url)
|
||||
})
|
||||
},
|
||||
onChange(value, render) {
|
||||
this.$emit('change', value, render)
|
||||
},
|
||||
onSave(value, render) {
|
||||
this.$emit('save', value, render)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user