我正在尝试将 vueDraggable 与 vuetify 一起使用,以创建一个允许重新排列顺序的照片库。
如果没有 Draggable,v-img 会正确加载图像。
在我添加可拖动对象后,图像不会被加载。
为了测试图像路径是否正确,我在下面添加了一个并且加载正确。
https://codepen.io/brian661/pen/zVygap/
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<v-layout>
<v-flex xs12>
<v-card>
<v-container grid-list-sm fluid>
<v-layout row wrap>
<draggable
class="draggableArea"
:list="photos"
:group="{ name: 'photo', pull: 'clone', put: false }"
:sort= false
>
<v-flex
v-for="photo in photos"
:key=photo.name
xs3
d-flex
>
{{photo.name}}
<v-card flat tile class="d-flex">
// this is not able to be loaded
<v-img
:contain="true"
:src=photo.img
:lazy-src=photo.img
class="grey lighten-2"
>
// this is loaded without problem
<img :src=photo.img class="Photo"/>
<template v-slot:placeholder>
<v-layout
fill-height
align-center
justify-center
ma-0
>
<v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
</v-layout>
</template>
</v-img>
</v-card>
</v-flex>
</draggable>
</v-layout>
</v-container>
</v-card>
</v-flex>
</v-layout>
</template>
<script>
import draggable from 'vuedraggable';
export default {
name: "AvailablePhoto",
components: {
draggable,
},
data() {
return {
photos : [ {name: "photo1", img: "https://somewhere/1.png"},
{name: "photo2", img: "https://somewhere/2.png"},
{name: "photo3", img: "https://somewhere/3.png"},
{name: "photo3", img: "https://somewhere/4.png"}]
}
}
}
</script>
<style scoped>
.draggableArea {
display: flex;
}
.Photo {
max-width: 100%;
max-height: 100%;
}
</style>