you cant access to database directly from client frameworks like vue or react or even pure js, what you need is an api endpoint that provided by a server that serves data you want. you can learn how to CRUD operations using vue and laravel in https://www.positronx.io/create-laravel-vue-js-crud-single-page-application/
Feb 11, 2023
2
Level 1
Getting data from database in vue.js by id
I want to get data from the database in script in my vue.js file. And I tried everything find function, where function and so on and I will always get the error str.replace is not a function(). Some examples of what I tried
this.data = this.packages.where("id", id)
this.data = this.packages.find(id)
An id is a type number. And I don't have this. before because I am calling it to the method, but even if I do the additional step and do
this.id = id
this.data = this.packages.find(this.id)
It does not have any effect. This is how the error looks like: https://imagizer.imageshack.com/img923/966/o4TfGA.png Any idea how I could solve this
Please or to participate in this conversation.