import car from '@/utils/controls/car';
import user from '@/user';
import config from '@/config/config';
export default {

    onLoad(){
      this.name = (this.__route__ || '').split('/').pop();
    },

    onShow(){
        // 更新针对 购物车的数量角标
        if (!car.__load && !car.status && user.user && user.isLogin()) {
            car.getCartNumber(true).then(()=> car.__load = true);
        }
        config.page = this;
        car.checkSet();
    },

    onShareAppMessage(){

        let title = '';

        try {
            title =  this.$store.state.config.name;
        } catch (e) {
            title='沣胜食品商城'
        }

        return {
            title: title,
            path:'/pages/index/index'
        }
    }

}
