1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <div>
- <!-- 按钮 -->
- <button
- :class="['buttonBorder', !_rotate ? 'dlbutton' : 'dlbutton_loading']"
- :style="{ background: bgColor, color: fontColor }"
- >
- <div :class="_rotate ? 'rotate_loop' : ''">
- <span v-if="_rotate" class="cuIcon cuIcon-loading1 "></span>
- <span v-if="!_rotate">{{ text }}</span>
- </div>
- </button>
- </div>
- </template>
- <script>
- export default {
- props: {
- text: String, //显示文本
- rotate: {
- //是否启动加载
- type: [Boolean, String],
- default: false
- },
- bgColor: {
- //按钮背景颜色
- type: String,
- default: ""
- },
- fontColor: {
- //按钮字体颜色
- type: String,
- default: "#FFFFFF"
- }
- },
- computed: {
- _rotate() {
- //处理值
- return String(this.rotate) !== "false";
- }
- }
- };
- </script>
- <style>
- @import url("./css/icon.css");
- .dlbutton {
- display: flex;
- justify-content: center;
- align-items: center;
- color: #ffffff;
- font-size: 18px;
- width: 100%;
- height: 50px;
- background: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.6));
- box-shadow: 0px 0px 13px 0px rgba(164, 217, 228, 0.4);
- border-radius: 25px;
- margin: 0 auto;
- outline: none;
- }
- .dlbutton_loading {
- display: flex;
- justify-content: center;
- align-items: center;
- color: #ffffff;
- font-size: 18px;
- width: 50px;
- height: 50px;
- background: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.6));
- box-shadow: 0px 0px 13px 0px rgba(164, 217, 228, 0.4);
- border-radius: 25px;
- margin: 0 auto;
- outline: none;
- }
- .buttonBorder {
- border: none;
- border-radius: 25px;
- box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2);
- transition: all 0.4s cubic-bezier(0.57, 0.19, 0.51, 0.95);
- background: #e56463;
- }
- /* 旋转动画 */
- .rotate_loop {
- transition-property: transform;
- transition-duration: 1s;
- animation: rotate 1s linear infinite;
- }
- @keyframes rotate {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(359deg);
- }
- }
- </style>
|