import tabsData from "../data/tabs";

import notice from '@/utils/notice';

export default {

    data(){
        return {
            tabsData:tabsData,
            loadings:[],
            value:0,
            first:false,
            payModal:false,
            payModalMessage:''
        }
    },

    onLoad:function(){

        if (this.$params.select) {
            this.value = parseInt(this.$params.select);
        } else {
            this.first = true;
        }

    },

    methods:{
        /* 更改绑定 */
        bindTarget:function(detail){
            this.target[detail.type] = detail.target;
        },

        /* change的时候触发 */
        change:function(detail){
            if (detail.loading) {
                setTimeout(()=>{
                    this.$set(this.loadings,detail.index,true)
                },300);
            }

        },

        openPayModal(item){
            if (!this.payModal) {
                this.payModal = true;
                this.payModalMessage = item.msg;
            }
        }
    },

    created(){
        this.target = {};
        notice.trigger('user',{
            update:true
        });
    }

}