Vben
2021-06-09 55e9d9fc2953643cec95c74b6ed34b0e68641fb6
src/components/Basic/src/BasicArrow.vue
@@ -9,43 +9,50 @@
</template>
<script lang="ts">
  import { defineComponent, computed } from 'vue';
  import { RightOutlined } from '@ant-design/icons-vue';
  import { Icon } from '/@/components/Icon';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { propTypes } from '/@/utils/propTypes';
  import { Icon } from '/@/components/Icon';
  const props = {
    /**
     * Arrow expand state
     */
    expand: { type: Boolean },
    /**
     * Arrow up by default
     */
    up: { type: Boolean },
    /**
     * Arrow down by default
     */
    down: { type: Boolean },
    /**
     * Cancel padding/margin for inline
     */
    inset: { type: Boolean },
  };
  export default defineComponent({
    name: 'BasicArrow',
    components: { RightOutlined, Icon },
    props: {
      // Expand contract, expand by default
      expand: propTypes.bool,
      top: propTypes.bool,
      bottom: propTypes.bool,
      inset: propTypes.bool,
    },
    components: { Icon },
    props,
    setup(props) {
      const { prefixCls } = useDesign('basic-arrow');
      // get component class
      const getClass = computed(() => {
        const { expand, top, bottom, inset } = props;
        const { expand, up, down, inset } = props;
        return [
          prefixCls,
          {
            [`${prefixCls}--active`]: expand,
            top,
            up,
            inset,
            bottom,
            down,
          },
        ];
      });
      return {
        getClass,
      };
      return { getClass };
    },
  });
</script>
@@ -54,6 +61,7 @@
  .@{prefix-cls} {
    display: inline-block;
    cursor: pointer;
    transform: rotate(0deg);
    transition: all 0.3s ease 0.1s;
    transform-origin: center center;
@@ -66,19 +74,19 @@
      line-height: 0px;
    }
    &.top {
    &.up {
      transform: rotate(-90deg);
    }
    &.bottom {
    &.down {
      transform: rotate(90deg);
    }
    &.top.@{prefix-cls}--active {
    &.up.@{prefix-cls}--active {
      transform: rotate(90deg);
    }
    &.bottom.@{prefix-cls}--active {
    &.down.@{prefix-cls}--active {
      transform: rotate(-90deg);
    }
  }