index.js 481 B

12345678910111213141516171819202122232425262728
  1. import { getCategoryList } from '../../services/good/fetchCategoryList';
  2. Page({
  3. data: {
  4. list: [],
  5. },
  6. async init() {
  7. try {
  8. const result = await getCategoryList();
  9. this.setData({
  10. list: result,
  11. });
  12. } catch (error) {
  13. console.error('err:', error);
  14. }
  15. },
  16. onShow() {
  17. this.getTabBar().init();
  18. },
  19. onChange() {
  20. wx.navigateTo({
  21. url: '/pages/goods/list/index',
  22. });
  23. },
  24. onLoad() {
  25. this.init(true);
  26. },
  27. });