index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { link } from '../mixins/link';
  2. import { VantComponent } from '../common/component';
  3. VantComponent({
  4. classes: [
  5. 'num-class',
  6. 'desc-class',
  7. 'thumb-class',
  8. 'title-class',
  9. 'price-class',
  10. 'origin-price-class',
  11. ],
  12. mixins: [link],
  13. props: {
  14. tag: String,
  15. num: String,
  16. desc: String,
  17. thumb: String,
  18. title: String,
  19. price: {
  20. type: String,
  21. observer: 'updatePrice',
  22. },
  23. centered: Boolean,
  24. lazyLoad: Boolean,
  25. thumbLink: String,
  26. originPrice: String,
  27. thumbMode: {
  28. type: String,
  29. value: 'aspectFit',
  30. },
  31. currency: {
  32. type: String,
  33. value: '¥',
  34. },
  35. },
  36. methods: {
  37. updatePrice() {
  38. const { price } = this.data;
  39. const priceArr = price.toString().split('.');
  40. this.setData({
  41. integerStr: priceArr[0],
  42. decimalStr: priceArr[1] ? `.${priceArr[1]}` : '',
  43. });
  44. },
  45. onClickThumb() {
  46. this.jumpLink('thumbLink');
  47. },
  48. },
  49. });