~jiyu/Jiyu-Web

ref: 15ea2212db9a6bcbd55997e7812575649a3b9ce8 Jiyu-Web/resources/js/Backend/Components/PageContent.vue -rw-r--r-- 780 bytes
15ea2212jiyu Sortable elements are now savable 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<template>
    <draggable v-model="page.content" @end="endDrag">
        <template v-for="element in page.content">
            <component
                v-bind:is="element.type + '-element'"
                :element="element"
                :title="element.type == 'title' && page.title"
            >
            </component>
        </template>
    </draggable>
</template>

<script>
    import draggable from 'vuedraggable';
    import Elements from '../Elements';

    export default {
        name: "page-content",
        props: {
            page: Object
        },
        methods: {
            endDrag() {
                this.$emit('pageUpdate');
            }
        },
        components: {
            ...Elements,
            draggable
        }
    }
</script>