header.js 669 B

1234567891011121314151617181920212223242526272829
  1. // components/header/header.js
  2. Component({
  3. properties: {
  4. // header嵌入的位置,index:首页
  5. position:{
  6. type:String,
  7. value:''
  8. }
  9. },
  10. data: {
  11. index:0
  12. },
  13. observers:{
  14. // 是否是预售、新品、上架
  15. position:function(value){
  16. this.setData({
  17. specialProds:value === "new" || value === "hot" || value === "presale" || value === "sort"
  18. })
  19. }
  20. },
  21. methods: {
  22. backHome(){
  23. wx.navigateBack(-1);
  24. },
  25. },
  26. ready: function(){
  27. console.log(this.data.position);
  28. }
  29. })