| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <!--
- * @Descripttion: 状态指示器
- * @version: 1.0
- * @Author: sakuya
- * @Date: 2021年11月11日09:30:12
- * @LastEditors:
- * @LastEditTime:
- -->
- <template>
- <div :class="['sc-status-indicator', content && 'hasValue']">
- <span class="sc-state" :class="[{ 'sc-status-processing': pulse }, 'sc-state-bg--' + type]"></span>
- {{ content }}
- </div>
- </template>
- <script>
- export default {
- props: {
- type: { type: String, default: "primary" },
- pulse: { type: Boolean, default: false },
- content: { type: String, default: "" }
- }
- }
- </script>
- <style scoped>
- .sc-status-indicator {display: flex;align-items: center;}
- .sc-state {
- display: inline-block;
- background: #000;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- vertical-align: middle;
- }
- .sc-status-processing {
- position: relative;
- }
- .sc-status-processing:after {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 100%;
- height: 100%;
- border-radius: 50%;
- background: inherit;
- content: "";
- animation: warn 1.2s ease-in-out infinite;
- }
- .sc-state-bg--offline {
- background: rgba(0, 0, 0, 0.25);
- }
- .sc-state-bg--primary {
- background: var(--el-color-primary);
- }
- .sc-state-bg--success {
- background: var(--el-color-success);
- }
- .sc-state-bg--warning {
- background: var(--el-color-warning);
- }
- .sc-state-bg--danger {
- background: var(--el-color-danger);
- }
- .sc-state-bg--info {
- background: var(--el-color-info);
- }
- .sc-state-bg--orange {
- background: #fa8c16;
- }
- .sc-status-indicator.hasValue .sc-state {
- margin-right: 6px;
- }
- @keyframes warn {
- 0% {
- transform: scale(0.5);
- opacity: 1;
- }
- 30% {
- opacity: 0.7;
- }
- 100% {
- transform: scale(2.5);
- opacity: 0;
- }
- }
- </style>
|