dev
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<v-chip-group variant="flat" v-if="!hideFilter" class="pa-4" multiple column v-model="selectedTypes">
|
||||
<v-chip v-for="(f,i) in $p.objectTypes" :key="i" :text="l[f.value]" :value="f.value" :color="f.color" filter></v-chip>
|
||||
</v-chip-group>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col v-for="(v, i) in items" :key="i" cols="12" xs="6" sm="4" md="3" xl="2" class="position-relative">
|
||||
<!-- <router-link :to="`/game-objects/${v.id}`"> -->
|
||||
<v-img :src="`/asset/thumb/${v.asset?.thumb}`" class="cursor-pointer" @click="$emit('select', v)"></v-img>
|
||||
<!-- </router-link> -->
|
||||
<div class="d-flex">
|
||||
<span class="flex-grow-1">{{ v.name }}</span>
|
||||
<v-btn density="comfortable" size="small" :icon="`mdi-${ $p.objectTypes.find(t=>t.value == v.type).icon }`"
|
||||
:color="$p.objectTypes.find(t=>t.value == v.type).color" class="position-absolute top-0 left-0 ma-6"></v-btn>
|
||||
<v-btn density="comfortable" size="small" icon="mdi-play-circle" @click="preview(v)"
|
||||
color="light-blue-darken-4" class="position-absolute top-0 right-0 ma-6"></v-btn>
|
||||
<slot name="action-buttons" v-bind:object="v"></slot>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<v-dialog v-model="previewDialog" width="auto" max-width="1200">
|
||||
<AssetPreview :object="previewObject" autoplay></AssetPreview>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props:[
|
||||
'modelValue', 'query', 'hideFilter'
|
||||
],
|
||||
emits:['select', 'preview'],
|
||||
data(){
|
||||
return {
|
||||
items: [],
|
||||
q: {},
|
||||
selectedTypes: this.$p.objectTypes.map(f=>f.value),
|
||||
previewObject: null,
|
||||
previewDialog: false,
|
||||
}
|
||||
},
|
||||
|
||||
async created(){
|
||||
await this.load();
|
||||
},
|
||||
|
||||
watch:{
|
||||
async selectedTypes(n){
|
||||
this.q.type = { $in: n };
|
||||
await this.load();
|
||||
}
|
||||
},
|
||||
|
||||
methods:{
|
||||
async load(){
|
||||
Object.assign(this.q, this.query || {});
|
||||
this.items = (await this.$api.gameObject.search(this.q)).data.data;
|
||||
},
|
||||
preview(v){
|
||||
this.previewObject = v;
|
||||
this.previewDialog = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user