我正在使用vue.js
,并且正在完成vuetable
教程,但我的 vuetable 始终显示no data available
.
这是我的代码:
MyVueTable 组件:
<template>
<vuetable ref="vuetable"
api-url="http://dummy.restapiexample.com/api/v1/employees"
:fields="['id', 'name', 'salary', 'age', 'profile image']"
pagination-path=""
></vuetable>
</template>
<script>
import Vuetable from 'vuetable-2/src/components/Vuetable'
export default {
components: {
Vuetable
}
}
</script>
应用程序.vue
<template>
<div id="app">
<img src="./assets/logo.png">
<div class="ui container">
<my-vuetable></my-vuetable>
</div>
</div>
</template>
<script>
import MyVuetable from './components/MyVuetable'
export default {
name: 'app',
components: {
MyVuetable
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
我不明白 vuetable 如何获取数据并将其映射到指定字段。控制台中没有错误。
感谢任何帮助,因为我有点困惑。