初始化
This commit is contained in:
42
addons/webman/views/my_editor.vue
Normal file
42
addons/webman/views/my_editor.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<v-md-editor
|
||||
v-model="value"
|
||||
:disabled-menus="[]"
|
||||
@upload-image="handleUploadImage"
|
||||
height="500px"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
value:String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value: '',
|
||||
};
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const value = Vueuse.useVModel(props, 'value',ctx.emit)
|
||||
return {
|
||||
value
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleUploadImage(event, insertImage, files) {
|
||||
// 此处只做示例
|
||||
const FormData1=new FormData()
|
||||
FormData1.append("file",files[0])
|
||||
this.$request.post("ex-admin/addons-webman-controller-IndexController/myEditorUpload", FormData1,{
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}).then(response=>{
|
||||
console.log(response.data)
|
||||
insertImage({
|
||||
url:response.data.url
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user