|
|
@ -8,14 +8,14 @@ |
|
|
:showUploadList="false" |
|
|
:showUploadList="false" |
|
|
accept=".jpg,.jpeg,.gif,.png,.webp" |
|
|
accept=".jpg,.jpeg,.gif,.png,.webp" |
|
|
> |
|
|
> |
|
|
<a-button type="primary"> |
|
|
<a-button type="primary" v-bind="{ ...getButtonProps }"> |
|
|
{{ t('component.upload.imgUpload') }} |
|
|
{{ t('component.upload.imgUpload') }} |
|
|
</a-button> |
|
|
</a-button> |
|
|
</Upload> |
|
|
</Upload> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { defineComponent } from 'vue'; |
|
|
import { defineComponent, computed } from 'vue'; |
|
|
|
|
|
|
|
|
import { Upload } from 'ant-design-vue'; |
|
|
import { Upload } from 'ant-design-vue'; |
|
|
import { useDesign } from '/@/hooks/web/useDesign'; |
|
|
import { useDesign } from '/@/hooks/web/useDesign'; |
|
|
@ -29,15 +29,26 @@ |
|
|
fullscreen: { |
|
|
fullscreen: { |
|
|
type: Boolean, |
|
|
type: Boolean, |
|
|
}, |
|
|
}, |
|
|
|
|
|
disabled: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
emits: ['uploading', 'done', 'error'], |
|
|
emits: ['uploading', 'done', 'error'], |
|
|
setup(_, { emit }) { |
|
|
setup(props, { emit }) { |
|
|
let uploading = false; |
|
|
let uploading = false; |
|
|
|
|
|
|
|
|
const { uploadUrl } = useGlobSetting(); |
|
|
const { uploadUrl } = useGlobSetting(); |
|
|
const { t } = useI18n(); |
|
|
const { t } = useI18n(); |
|
|
const { prefixCls } = useDesign('tinymce-img-upload'); |
|
|
const { prefixCls } = useDesign('tinymce-img-upload'); |
|
|
|
|
|
|
|
|
|
|
|
const getButtonProps = computed(() => { |
|
|
|
|
|
const { disabled } = props; |
|
|
|
|
|
return { |
|
|
|
|
|
disabled, |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
function handleChange(info: Recordable) { |
|
|
function handleChange(info: Recordable) { |
|
|
const file = info.file; |
|
|
const file = info.file; |
|
|
const status = file?.status; |
|
|
const status = file?.status; |
|
|
@ -63,6 +74,7 @@ |
|
|
handleChange, |
|
|
handleChange, |
|
|
uploadUrl, |
|
|
uploadUrl, |
|
|
t, |
|
|
t, |
|
|
|
|
|
getButtonProps, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|