Vue's question about setting the Top div

divdiv

here is the code (some of the css code has been ignored)

template code

<template>
    <div>
        <div
            class="follow_contents_wrap"
            v-for="(list,index) in follow_contents"
            @mouseenter="btnsNow=index"
            @mouseleave="btnsNow=-1"
            v-dragging="{ item : list,list : follow_contents }"
            :key="list.title">
            <div 
                class="follow_contents_title_wrap">
                <div 
                    class="follow_contents_title_left"
                    @click="showList===index ? showList=-1 : showList=index"
                    :style="{borderBottom: "1px solid rgba(240,240,240,"+ changebackgroundopacity +")"}">
                    <div 
                        class="follow_contents_title_icon"
                        :class="index===showList?"":"special_none"">
                        <em></em>
                    </div>
                    <div class="follow_contents_title_name">
                        <span>
                            {{ list.title }}
                        </span>
                    </div>
                    <div class="follow_contents_title_counts">
                        <span>
                            (
                            {{ list.counts }}
                            )
                        </span>
                    </div>
                    <div class="div_clear"></div>
                </div>
                <div 
                    class="follow_contents_title_right"
                    v-show="index===btnsNow">
                    <div>
                        <span></span>
                    </div>
                    <div
                        :class="index===0 ? "top_index" : """
                        @click="">
                        <span></span>
                    </div>
                    <div class="div_clear"></div>
                </div>
            </div>
            <div 
                class="follow_contents_bottom"
                v-show="index===showList">
                <div></div>
            </div>
        </div>
    </div>
</template>

js partial code

export default{
    props: ["changebackgroundopacity"],
    data(){
        return{
            showList: "0",
            follow_contents: [
                {
                    title: "",
                    counts: "0"
                },
                {
                    title: "",
                    counts: "0"
                }
            ],
            btnsNow: "0"
        }
    }
}

seek advice from the great gods

Mar.03,2021

let arr = [0, 1, 2, 3]
function toTop (index) {
    if (index >= arr.length || index === 0) {
        return
    }
    let tempArr = JSON.parse(JSON.stringify(arr))
    return tempArr.splice(index, 1).concat(tempArr)
}

just insert the item'my Navigation'at the front of the array.

 <span @click='toTop(index)'></span>

toTop(index){
    this.follow_contents.unshift(...this.follow_contents.splice(index,1))
}


has been resolved. Thank you, as shown in figure

.
Menu