global.js 765 B

1234567891011121314151617181920212223242526272829303132333435
  1. import car from '@/utils/controls/car';
  2. import user from '@/user';
  3. import config from '@/config/config';
  4. export default {
  5. onLoad(){
  6. this.name = (this.__route__ || '').split('/').pop();
  7. },
  8. onShow(){
  9. // 更新针对 购物车的数量角标
  10. if (!car.__load && !car.status && user.user && user.isLogin()) {
  11. car.getCartNumber(true).then(()=> car.__load = true);
  12. }
  13. config.page = this;
  14. car.checkSet();
  15. },
  16. onShareAppMessage(){
  17. let title = '';
  18. try {
  19. title = this.$store.state.config.name;
  20. } catch (e) {
  21. title='沣胜食品商城'
  22. }
  23. return {
  24. title: title,
  25. path:'/pages/index/index'
  26. }
  27. }
  28. }