index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var component_1 = require("../common/component");
  4. var link_1 = require("../mixins/link");
  5. var button_1 = require("../mixins/button");
  6. var open_type_1 = require("../mixins/open-type");
  7. component_1.VantComponent({
  8. mixins: [link_1.link, button_1.button, open_type_1.openType],
  9. relation: {
  10. type: 'ancestor',
  11. name: 'goods-action',
  12. current: 'goods-action-button',
  13. },
  14. props: {
  15. text: String,
  16. color: String,
  17. loading: Boolean,
  18. disabled: Boolean,
  19. plain: Boolean,
  20. type: {
  21. type: String,
  22. value: 'danger'
  23. }
  24. },
  25. mounted: function () {
  26. this.updateStyle();
  27. },
  28. methods: {
  29. onClick: function (event) {
  30. this.$emit('click', event.detail);
  31. this.jumpLink();
  32. },
  33. updateStyle: function () {
  34. var _a = this.parent.children, children = _a === void 0 ? [] : _a;
  35. var length = children.length;
  36. var index = children.indexOf(this);
  37. this.setData({
  38. isFirst: index === 0,
  39. isLast: index === length - 1
  40. });
  41. }
  42. }
  43. });