fix(Image): loading placeholder not work

This commit is contained in:
chenjiahan
2020-08-26 16:24:02 +08:00
parent eb0cc05b12
commit c720eea831
6 changed files with 14 additions and 15 deletions
+3 -4
View File
@@ -37,7 +37,7 @@ export default createComponent({
setup(props, { emit, slots }) {
const error = ref(false);
const loading = ref(true);
const imageRef = ref(null);
const imageRef = ref();
const style = computed(() => {
const style = {};
@@ -94,11 +94,10 @@ export default createComponent({
};
const renderPlaceholder = () => {
if (props.loading && props.showLoading) {
if (loading.value && props.showLoading) {
return <div class={bem('loading')}>{renderLoadingIcon()}</div>;
}
if (props.error && props.showError) {
if (error.value && props.showError) {
return <div class={bem('error')}>{renderErrorIcon()}</div>;
}
};