storeItem.js 929 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // components/house-item/house-item.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. store: Object,
  8. index: Number
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. storeItem: null
  15. },
  16. attached() {
  17. this.setData({
  18. storeItem: this.data.store
  19. })
  20. if (this.data.storeItem.viewCount >= 10000) {
  21. this.setData({
  22. 'storeItem.viewCount': (this.data.storeItem.viewCount / 10000).toFixed(1) + 'w'
  23. })
  24. }
  25. },
  26. observers: {
  27. 'store': function (numberA, numberB) {
  28. console.log(numberA)
  29. this.setData({
  30. storeItem: this.properties.store
  31. })
  32. }
  33. },
  34. /**
  35. * 组件的方法列表
  36. */
  37. methods: {
  38. gotoWV(e) {
  39. let {
  40. id,
  41. index
  42. } = e.currentTarget.dataset
  43. console.log(id)
  44. let data = {
  45. id: id,
  46. index: index,
  47. }
  48. this.triggerEvent('gotoWV', data)
  49. }
  50. }
  51. })