简体   繁体   English

Spinner 不工作 vue.js

[英]Spinner not working vue.js

I use this package: https://github.com/greyby/vue-spinner for showing a spinner.我使用这个包: https : //github.com/greyby/vue-spinner来显示一个微调器。

<template>
  <pulse-loader :loading="loading" :color="color" :size="size"></pulse-loader>
</template>

<script>

import { PulseLoader } from 'vue-spinner/dist/vue-spinner.min.js';

export default {

  components: { PulseLoader },

  data () {
    return {
      loading: true,
      color: "black",
      size: "10"
    }
  }
}
</script>

For some reason the spinner is not showing???!?!出于某种原因,微调器没有显示????!?! There are no erros in my console!我的控制台中没有错误!

You should not be importing from the dist folder.您不应该从dist文件夹导入。

Please, try importing the vue component source, doing as shown in the documentation:请尝试导入vue组件源,按照文档中所示进行操作:

import PulseLoader from 'vue-spinner/src/PulseLoader.vue'

Docs: https://github.com/greyby/vue-spinner#es6文档: https : //github.com/greyby/vue-spinner#es6


UPDATE :更新

Considering Browserify restriction on applying transforms in files inside node_modules , then you could try the code snippet provided in the mentioned GitHub issue :在内部文件应用转换时考虑Browserify限制node_modules ,那么你可以尝试在代码中的代码片段提供提到GitHub的问题

var PulseLoader = require('vue-spinner/dist/vue-spinner.min').PulseLoader;

The website I was working on had a custom CSS-file.我工作的网站有一个自定义的 CSS 文件。 It was missing the correct styles.它缺少正确的样式。 Possibly because it was for an older version of Bootstrap.可能是因为它用于旧版本的 Bootstrap。

Make sure that there is a definition for .spinner-border anywhere in your styles.确保在您的样式中的任何地方.spinner-border的定义。 If not, find out why not and fix it.如果没有,找出原因并修复它。

I have copied the style from the source-code of the Vue examples page for a quick fix.为了快速修复,我从Vue 示例页面的源代码中复制了样式。

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: .25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    -webkit-animation: spinner-border .75s linear infinite;
    animation: spinner-border .75s linear infinite;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM