1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <article class="card minicard">
- <header>
- <h1>{{ item.title }}</h1>
- <span class="ref">{{ item.field_reference }}</span>
- </header>
- <nav class="tools">
- <section class="tool flags">
- <span
- class="mdi unflag"
- :class="[
- itemIsLoading() ? 'mdi-loading mdi-spin' : 'mdi-folder-remove'
- ]"
- @click.prevent="onUnFlagCard"
- />
- </section>
- </nav>
- <section class="images" v-switcher>
- <figure
- v-for="(img, index) in item.images"
- :key="img.url"
- >
- <img
- class="lazy"
- v-lazy="index"
- :data-src="img.style_minicard.url"
- :title="img.title"
- />
- <img class="blank" :src="blanksrc">
- </figure>
- </section>
- </article>
- </template>
- <script>
- import { mapState, mapActions } from 'vuex'
- import cardMixins from 'vuejs/components/cardMixins'
- export default {
- name: "MiniCard",
- props: ['item', 'collid'],
- mixins: [cardMixins],
- data() {
- return {
- blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
- loadingItem: false
- }
- },
- computed: {
- },
- methods: {
- ...mapActions({
- flagUnflag: 'User/flagUnflag'
- }),
- itemIsLoading(id) {
- return this.loadingItem
- },
- onUnFlagCard (e) {
- console.log("Card onFlagActionCard", e, this.item);
- if (!this.loadingItem) {
- this.loadingItem = true;
- this.flagUnflag({
- action: 'unflag',
- id: this.item.id,
- collid: this.collid
- })
- .then(data => {
- console.log("onUnFlagCard then", data);
- this.loadingItem = false;
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|