how to keep state in vue jsx component?

Viewed 52

i want to render a search input in table column heads, it needs keeping a keyword state in itself, but it's value won't change with user input. so how to resolve the keyword state?

enter image description here text code here

function renderInputFilter(submit: (keyword: string) => void) {
  const keyword = ref('')
  return <div>
    <ElInput placeholder="input keyword" v-model={keyword.value} />
    <ElButton type="primary" icon="el-icon-search" onClick={() => submit(keyword.value)} />
  </div>
}
1 Answers
Related