index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="main">
  3. {{info}}
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. config: {},
  11. user: {},
  12. }
  13. },
  14. onLoad: async function(e) {
  15. const that = this;
  16. uni.setNavigationBarTitle({
  17. title: e && e.title || '分类'
  18. });
  19. await that.searchOther();
  20. that.searchConfig();
  21. that.searchToken();
  22. that.search();
  23. },
  24. methods: {
  25. searchToken() {
  26. const that = this;
  27. try {
  28. const res = uni.getStorageSync('token');
  29. if (res) that.$set(that, `user`, res);
  30. } catch (e) {
  31. uni.showToast({
  32. title: err.errmsg,
  33. icon: 'error',
  34. duration: 2000
  35. });
  36. }
  37. },
  38. searchConfig() {
  39. const that = this;
  40. try {
  41. const res = uni.getStorageSync('config');
  42. if (res) that.$set(that, `config`, res);
  43. } catch (e) {
  44. uni.showToast({
  45. title: err.errmsg,
  46. icon: 'error',
  47. duration: 2000
  48. });
  49. }
  50. },
  51. // 查询
  52. async search() {
  53. const that = this;
  54. let res;
  55. },
  56. async searchOther() {
  57. const that = this;
  58. }
  59. }
  60. }
  61. </script>
  62. <style>
  63. .main {}
  64. </style>