indexRight.js 686 B

12345678910111213141516171819202122232425262728293031323334
  1. const app = getApp();
  2. Component({
  3. data:{
  4. productList:[],
  5. prductIndex:'',
  6. },
  7. lifetimes: {
  8. attached: function () {
  9. this.getProductName()
  10. },
  11. moved: function () { },
  12. detached: function () { },
  13. },
  14. methods:{
  15. getProductName(){
  16. app.requestP({
  17. url: '/showApi/getProductList',
  18. method: 'get',
  19. needToken:false
  20. }).then(res=>{
  21. this.setData({
  22. productList:res.data.data,
  23. prductIndex:res.data.data[0]
  24. })
  25. }).catch(err=>{
  26. app.showToptip(this,'error',err.data.msg);
  27. })
  28. },
  29. goPage1(){
  30. console.log(112)
  31. this.triggerEvent('goPage1', {}, {})
  32. },
  33. }
  34. })