123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <view class="animations" v-if="is_loading">
- <view class="box">
- <view class="dot dot1"></view>
- <view class="dot dot2"></view>
- <view class="dot dot3"></view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "loading-bounce",
- data() {
- return {};
- },
- methods:{
- switch_loading(){
- this.$store.commit("switch_loading")
- }
- },
- //实测直接在标签属性里写 $store.state.XX 拿不到数据 所以这里通过 计算属性去监听一下
- computed:{
- is_loading(){
- return this.$store.state.user.loading
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .animations{display: flex;align-items: center;justify-content: center;position: fixed;top: 40%;left: 0;right: 0;z-index: 3;}
- .box {
- width: 100rpx;
- height: 50rpx;
- position: relative;
- }
- .dot {
- width: 18rpx;
- height: 18rpx;
- background: #007aff;
- border-radius: 50%;
- position: absolute;
- top: calc(50% - 5rpx);
- }
- .dot1 {
- background: #1fa2ff;
- left: 0rpx;
- -webkit-animation: bounce 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
- infinite;
- animation: bounce 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
- }
- .dot2 {
- background: #12d8fa;
- left: 40rpx;
- -webkit-animation: bounce 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28)
- alternate infinite;
- animation: bounce 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
- infinite;
- }
- .dot3 {
- background: #29ffc6;
- left: 80rpx;
- -webkit-animation: bounce 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28)
- alternate infinite;
- animation: bounce 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
- infinite;
- }
- @-webkit-keyframes bounce {
- 0% {
- -webkit-transform: translateY(0);
- transform: translateY(0);
- }
- 100% {
- -webkit-transform: translateY(-20rpx);
- transform: translateY(-20rpx);
- }
- }
- @keyframes bounce {
- 0% {
- -webkit-transform: translateY(0);
- transform: translateY(0);
- }
- 100% {
- -webkit-transform: translateY(-20rpx);
- transform: translateY(-20rpx);
- }
- }
- </style>
|