php framework laravel build vue3 use defineModel not run #12663
Unanswered
hlxvi
asked this question in
Help/Questions
Replies: 1 comment
-
The error indicates that due to a type assignment. import type { ModelRef } from 'vue';
const modelValue = defineModel() as ModelRef<string>; Additionally make sure that the value passed to the v-model is of the same type
Remember it may vary if the v-model has 2 points or not al inicio
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
laravel version 8.5
use
npm install vue
command to install vueuse
npm install ts-loader
command to install ts-loaderuse
npm install typescript
command to install typescriptpackage.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"vue-loader": "^16.8.0"
},
"dependencies": {
"ts-loader": "^9.5.1",
"typescript": "^5.7.2",
"vue": "^3.5.13",
"vue-router": "^4.5.0",
"webpack-cli": "^6.0.1"
}
}
vue code:
<script lang="ts" setup> const modelValue = defineModel() modelValue.value = "hello" </script>vue3
npm run watch
✖ Mix
Compiled with some errors in 18.32s
ERROR in Join.vue.ts
14:29-35
[tsl] ERROR in Join.vue.ts(14,30)
TS2558: Expected 3-5 type arguments, but got 1.
ERROR in Join.vue.ts
15:0-16
[tsl] ERROR in Join.vue.ts(15,1)
TS2322: Type 'string' is not assignable to type 'T[K]'.
'string' is assignable to the constraint of type 'T[K]', but 'T[K]' could be instantiated with a different subtype of constraint 'any'.
webpack compiled with 2 errors
Beta Was this translation helpful? Give feedback.
All reactions