I'm trying to utilize a NPM package called vue-simple-spinner
in my Vue CLI webpack application, but I keep encountering this error message:
Unknown custom element: <vue-simple-spinner> - have you registered the component correctly? For recursive components, make sure to provide the "name" option.
The documentation states: https://i.sstatic.net/2dAAr.png
Following that, I added the following code in my main.js
file:
import Vue from 'vue'
import App from './App'
import router from './router'
import Spinner from 'vue-simple-spinner'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Vue.config.productionTip = false
Vue.use(BootstrapVue)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: {
App,
Spinner
},
template: '<App/>'
})
Further instructions from the documentation say:
https://i.sstatic.net/yudQi.png
I have included the
<vue-simple-spinner></view-simple-spinner>
tags but I am unsure of where or how to include the JavaScript scripts. I tried including them in the template (which resulted in an error) and also attempted importing the component using import Spinner from 'vue-simple-spinner'
but both approaches are still triggering the Unknown custom element
error.
How can I properly include the scripts and/or register the component?
This is the complete content of my Vue app file:
<template>
<div id="app" class="container">
<div>
<h1>Market Price Spreads</h1>
<button type="button" class="btn btn-primary" v-on:click="loadMarkets()">Refresh Markets</button>
<vue-simple-spinner></vue-simple-spinner>
</div>
<div class="main-table">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Market</th>
<th>Poloniex</th>
<th>Bittrex</th>
<th>Spread</th>
</tr>
</thead>
<tbody>
<tr v-for="market in markets">
<td>{{ market[0] }}</td>
<td>{{ market[1] | round(6) }}</td>
<td>{{ market[2] | round(6)}}</td>
<td>{{ market[3] | round(2)}} %</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script>
/* eslint-disable */
import loadDataMixin from './components/mixins/loadDataMixin'
export default {
name: 'App',
mixins: [loadDataMixin],
filters: {
round: function(number, places) {
return number.toFixed(places)
}
},
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
margin-top: 60px;
}
.main-table {
margin-top: 20px;
}
</style>