_vm.form.errors.has is not a function
See original GitHub issueHi,
I’m trying to set up a edit page, however while receiving the data (to put in the input fields etc), I get this error. It looks like that its an issue with the vForm.
data() {
return {
form: new Form({
serverid: '',
name: '',
ipaddress: '',
port: '',
cfapikey: '',
description: '',
coverimg: null,
serverimg: null
}),
coverImgUrl: '',
serverImgUrl: '',
}
},
async fetch() {
const data = await this.form.get('/server/' + this.$route.params.serverid)
this.form.keys().forEach((key) => {
this.form[key] = data.data[key]
})
console.log(this.form)
},
or just
async asyncData({ $axios, params }) {
const data = await axios.get('/server/' + params.serverid)
return {
form: new Form(data.data),
serverImgUrl: '',
coverImgUrl: ''
}
},
always prints out _vm.form.errors.has is not a function
it works when I wrap my template to a client-only page, but I need to use SSR in NuxtJS.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to get rid of Error in v-on handler: "TypeError: _vm.myFcn ...
"TypeError: _vm.debouncedOnSubmit is not a function" means vuejs can not find any function in it's build- ...
Read more >TypeError: _vm.form.errors.has is not a function #5249 - GitHub
Version : 2.2.4 i export to my app: class Error { constructor() { this.errors = {} } has(input) { return this.errors.
Read more >TypeError (...) is not a function - Get Help - Vue Forum
Hello there, I have a problem with compiling a vue file. ... is not a function" - TypeError: vm.kundeinputstore is not a function....
Read more >How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >How to solve “Submit is not a function” error in JavaScript
Solution 1: Simply rename your button's name to btnSubmit or any other name. Your code will miraculously work. This is because you have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You are returning the form instance from asyncData, but that won’t work with SSR. Here’s how you do it: https://codesandbox.io/s/stoic-minsky-j5pgl?file=/pages/index.vue
You would just create 2 forms one for create and one for update with only the fields you need for that action. Or do some checks on your back-end.