12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- exports.__esModule = true;
- exports.default = void 0;
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
- var _utils = require("../utils");
- var _router = require("../utils/router");
- var _relation = require("../mixins/relation");
- var _button = _interopRequireDefault(require("../button"));
- var _createNamespace = (0, _utils.createNamespace)('goods-action-button'),
- createComponent = _createNamespace[0],
- bem = _createNamespace[1];
- var _default = createComponent({
- mixins: [(0, _relation.ChildrenMixin)('vanGoodsAction')],
- props: (0, _extends2.default)({}, _router.routeProps, {
- type: String,
- text: String,
- icon: String,
- color: String,
- loading: Boolean,
- disabled: Boolean
- }),
- computed: {
- isFirst: function isFirst() {
- var prev = this.parent && this.parent.children[this.index - 1];
- return !prev || prev.$options.name !== this.$options.name;
- },
- isLast: function isLast() {
- var next = this.parent && this.parent.children[this.index + 1];
- return !next || next.$options.name !== this.$options.name;
- }
- },
- methods: {
- onClick: function onClick(event) {
- this.$emit('click', event);
- (0, _router.route)(this.$router, this);
- }
- },
- render: function render() {
- var h = arguments[0];
- return h(_button.default, {
- "class": bem([{
- first: this.isFirst,
- last: this.isLast
- }, this.type]),
- "attrs": {
- "size": "large",
- "type": this.type,
- "icon": this.icon,
- "color": this.color,
- "loading": this.loading,
- "disabled": this.disabled
- },
- "on": {
- "click": this.onClick
- }
- }, [this.slots() || this.text]);
- }
- });
- exports.default = _default;
|