当前位置: 首页 > 工具软件 > Q.js > 使用案例 >

quasar ajax用法,vue.js - Quasar q-table not rendering data from AJAX - Stack Overflow

宰父衡
2023-12-01

title="posts"

dense

:data="posts"

:columns="columns"

row-key="name"

>

import { api } from 'boot/axios'

export default {

name: 'PageIndex',

data () {

return {

columns: [

{

name: 'id',

label: 'the id',

field: 'id',

align: 'left',

sortable: true

}

],

posts: []

}

},

methods: {

getPosts () {

api.get('https://jsonplaceholder.typicode.com/posts')

.then(response => {

this.posts = response.data

console.log(this.posts)

})

.catch(error =>{

console.log(error)

})

}

},

mounted () {

this.getPosts()

}

}

I'm starting up with quasar framework and trying to get a simple q-table that gets populated from an ajax call. I don't see any errors (which would have been helpful) but data is not showing up. Is there something I'm missing here. Any pointers would help.

Also, I see the data coming back from the ajax call. But data is not making it to the q-table.

Best,

 类似资料: