Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$attrs 与 v-model结合使用value未被接收问题 #6

Open
bienvenidoY opened this issue Dec 26, 2020 · 0 comments
Open

$attrs 与 v-model结合使用value未被接收问题 #6

bienvenidoY opened this issue Dec 26, 2020 · 0 comments
Labels

Comments

@bienvenidoY
Copy link
Owner

问题

在avue-cli中使用项目时,使用v-model 与 $attrs时,子组件无法接收到value

--- Vue 2.5.2 ---

// child.vue
<template>
	<div>
    <!-- {} -->
    {{$attrs}}
  </div>	
</template>

//parent.vue
<template>
	<div>
  <Child v-model="parentVal" />
  </div>	
</template>	
<script>
export default{
  data() {
    return {
      parentVal: 'parentVal',
    }
  }
}
</script>

--- Vue 2.6.1 ---

// child.vue
<template>
	<div>
    <!-- {value: 'parentVal'} -->
    {{$attrs}}
  </div>	
</template>

//parent.vue
<template>
	<div>
  <Child v-model="parentVal" />
  </div>	
</template>	
<script>
export default{
  data() {
    return {
      parentVal: 'parentVal',
    }
  }
}
</script>

解决

使用vue 2.6.1以上版本

资料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant