我想获取查询结果(选择)并将其推入用户数组以在页面中显示(我使用ElectronJs和Vuejs框架)
<script>
import { s } from '../db'
export default {
name: 'home',
data () {
return {
message: 'Login UI',
users: []
}
},
methods: {
init: function () {
var query = 'SELECT * FROM `tbl_produit`';
s.query(query, function(err, rows, fields) {
if(err){
console.log("An error ocurred performing the query.");
console.log(err);
return;
}
console.log(rows)
})
}
},
beforeMount () {
this.init()
}
}
</script>