Skip to content

a-input 组件不受控 #7720

@guaijie

Description

@guaijie
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

undefined

Environment

vue: 3.x ; ant-design-vue: 4.2.3

Reproduction link

Edit on CodeSandbox

a-input 组件不受控

<template>
  <h1>{{ msg }}</h1>
  <a-input v-model:value="msg" @input="handleChange" />
  <!-- 非受控组件 -->
  <a-input :value="1" />
  <!-- 受控组件 -->
  <a-select style="width: 100%" :value="1" :options="options" />
</template>
<script lang="ts" setup>
import { ref } from "vue";
const msg = ref();
const options = [
  { label: 1, value: 1 },
  { label: 2, value: 2 },
];
const handleChange = () => {
  msg.value = "Hello";
};
</script>

What is expected?

期待 a-input 组件与 a-select 组件一样,都是受控组件

What is actually happening?

no response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions