index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. var _component = require("../common/component");
  3. var _link = require("../mixins/link");
  4. var _button = require("../mixins/button");
  5. var _openType = require("../mixins/open-type");
  6. (0, _component.VantComponent)({
  7. mixins: [_link.link, _button.button, _openType.openType],
  8. relation: {
  9. type: "ancestor",
  10. name: "goods-action",
  11. current: "goods-action-button"
  12. },
  13. props: {
  14. text: String,
  15. color: String,
  16. loading: Boolean,
  17. disabled: Boolean,
  18. plain: Boolean,
  19. type: {
  20. type: String,
  21. value: "danger"
  22. }
  23. },
  24. methods: {
  25. onClick: function onClick(event) {
  26. this.$emit("click", event.detail);
  27. this.jumpLink();
  28. },
  29. updateStyle: function updateStyle() {
  30. if (this.parent == null) {
  31. return;
  32. }
  33. var _this$parent$children = this.parent.children,
  34. children = _this$parent$children === void 0 ? [] : _this$parent$children;
  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. });