store-product-item.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Component({
  2. behaviors: [],
  3. properties: {
  4. appid: { // 属性名
  5. type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
  6. value: '', // 属性初始值(可选),如果未指定则会根据类型选择一个
  7. observer: function(newVal, oldVal, changedPath) {
  8. // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
  9. // 通常 newVal 就是新设置的数据, oldVal 是旧数据
  10. }
  11. },
  12. productId: String, // 简化的定义方式
  13. // productPromotionLink: String // 简化的定义方式
  14. },
  15. data: {
  16. customStyle: {
  17. card: {
  18. 'background-color': '#FFFFFF',
  19. },
  20. title: {
  21. color: 'rgba(0, 0, 0, 0.8)',
  22. },
  23. price: {
  24. color: '#FF6146'
  25. },
  26. 'buy-button': {
  27. width: '100px',
  28. 'border-radius': '30px',
  29. 'background-color': 'rgba(0,0,0,0.9)',
  30. color: '#FFD48D',
  31. },
  32. 'buy-button-disabled': {
  33. width: '100px',
  34. 'border-radius': '30px',
  35. 'background-color': 'rgba(0,0,0,0.9)',
  36. color: '#FFD48D',
  37. },
  38. },
  39. }, // 私有数据,可用于模版渲染
  40. // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
  41. attached: function(){},
  42. moved: function(){},
  43. detached: function(){},
  44. methods: {
  45. clickHandler () {
  46. console.log('clicked')
  47. }
  48. }
  49. })