| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <div
- :class="{'vl-mask': enableMask}"
- class="VciLoading vci-flex-ccm"
- >
- <svg
- class="circular"
- viewBox="25 25 50 50"
- >
- <circle
- :style="{stroke: color}"
- class="path"
- cx="50"
- cy="50"
- fill="none"
- r="20"
- ></circle>
- </svg>
- <TextBounce
- v-if="text"
- :style="{color: textColor}"
- :text="text"
- class="text"
- />
- </div>
- </template>
- <script>
- import VciTextBounce from "../../text/VciTextBounce.vue";
- export default {
- name: "VciLoading",
- components: { TextBounce: VciTextBounce },
- props: {
- color: {
- default: "#fff",
- type: String
- },
- text: {
- default: "加载中",
- type: String
- },
- textColor: {
- default: "#fff",
- type: String
- },
- enableMask: {
- type: Boolean,
- default: false
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @use "@vci/style/src/var" as va;
- .VciLoading {
- padding: 12px 24px;
- border-radius: 8px;
- min-width: 120px;
- transition: va.$transition-slow;
- &.vl-mask {
- background-color: rgba(0, 0, 0, .2);
- }
- .circular {
- height: 42px;
- width: 42px;
- animation: loading-rotate 2s linear infinite;
- transition: va.$transition-slow;
- .path {
- animation: loading-dash 1.5s ease-in-out infinite;
- stroke-dasharray: 90, 150;
- stroke-dashoffset: 0;
- stroke-width: 3;
- stroke: #5185e9;
- stroke-linecap: round;
- }
- @keyframes loading-rotate {
- to {
- transform: rotate(1turn)
- }
- }
- @keyframes loading-dash {
- 0% {
- stroke-dasharray: 1, 200;
- stroke-dashoffset: 0
- }
- 50% {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -40px
- }
- to {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -120px
- }
- }
- }
- .text {
- margin-top: 12px;
- transition: va.$transition-slow;
- text-shadow: 1px 0 1px #333,
- -1px 0 1px #333,
- 0 -1px 1px #333,
- 0 1px 1px #333;
- }
- }
- </style>
|