Showing
1 changed file
with
4 additions
and
1 deletions
| ... | ... | @@ -25,6 +25,8 @@ |
| 25 | 25 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 26 | 26 | import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum'; |
| 27 | 27 | import { getAuthCache } from '/@/utils/auth'; |
| 28 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
| 29 | + | |
| 28 | 30 | export default defineComponent({ |
| 29 | 31 | name: 'TinymceImageUpload', |
| 30 | 32 | components: { Upload }, |
| ... | ... | @@ -39,6 +41,7 @@ |
| 39 | 41 | }, |
| 40 | 42 | emits: ['uploading', 'done', 'error'], |
| 41 | 43 | setup(props, { emit }) { |
| 44 | + const { createMessage } = useMessage(); | |
| 42 | 45 | let uploading = false; |
| 43 | 46 | const token: string = getAuthCache(JWT_TOKEN_KEY); |
| 44 | 47 | const { uploadUrl } = useGlobSetting(); |
| ... | ... | @@ -55,7 +58,6 @@ |
| 55 | 58 | }); |
| 56 | 59 | |
| 57 | 60 | function handleChange(info: Recordable) { |
| 58 | - console.log(info); | |
| 59 | 61 | const file = info.file; |
| 60 | 62 | const status = file?.status; |
| 61 | 63 | const url = file?.response?.fileStaticUri; |
| ... | ... | @@ -72,6 +74,7 @@ |
| 72 | 74 | loading.value = false; |
| 73 | 75 | uploading = false; |
| 74 | 76 | } else if (status === 'error') { |
| 77 | + createMessage.error('图片上传失败'); | |
| 75 | 78 | emit('error'); |
| 76 | 79 | loading.value = false; |
| 77 | 80 | uploading = false; | ... | ... |