Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript Vue.js+;为什么v型不被认为是价值? 问题_Typescript_Vue.js_Vuejs2 - Fatal编程技术网

Typescript Vue.js+;为什么v型不被认为是价值? 问题

Typescript Vue.js+;为什么v型不被认为是价值? 问题,typescript,vue.js,vuejs2,Typescript,Vue.js,Vuejs2,我在Vue.js+TypeScript项目中遇到以下错误: <my-input> misses props: value MyFirstView.vue 现在,我想以以下方式使用myInput组件: <template> <div> <my-input v-model="myValue" /> </div> </template> <script lang="ts&qu

我在Vue.js+TypeScript项目中遇到以下错误:

<my-input> misses props: value
MyFirstView.vue 现在,我想以以下方式使用
myInput
组件:

<template>
  <div>
    <my-input v-model="myValue" />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import MyInput from '@/components/MyInput.vue';

@Component({
  components: { MyInput }
})
export default class MyFirstView extends Vue {
  myValue = 'my test value';
}
</script>
显然,我用
v-model
关键字设置了
value
属性,对吗?但是为什么我会得到
属性不会被设置的错误呢

当我将
required
关键字更改为
false
时,错误消失,但这不是正确的解决方案,对吗?因为我希望
属性是必需的



使用了IDE:VSCode和ESLint+Prettier以及Vue.js 2.6.11这是Vetur中的一个bug,在将Vetur更新到v0.27.2或更高版本时修复了。

我也收到了这个错误,但仅在VSCode中。我在命令行上的
npm run build
npm run serve
中没有看到此错误。@smeier_ec那么我的代码实际上是正确的?我会这么说。我不知道为什么VSCode会突然显示这些错误消息(我很确定几周前没有)。
<template>
  <div>
    <my-input v-model="myValue" />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import MyInput from '@/components/MyInput.vue';

@Component({
  components: { MyInput }
})
export default class MyFirstView extends Vue {
  myValue = 'my test value';
}
</script>
<my-input v-bind:value="myValue" v-on:input="myValue = $event" />