naive-ui/demo/documentation/components/input/enUS/clearable.demo.md
2020-10-22 12:12:11 +08:00

633 B

Clearable

Make input clearable when value is set.

<n-space vertical align="stretch">
  <n-input
    v-model:value="value"
    type="input"
    placeholder="Content is clearable"
    clearable
  />
  <n-input
    v-model:value="value"
    type="password"
    placeholder="Content is clearable"
    clearable
  />
  <n-input
    v-model:value="value"
    type="textarea"
    placeholder="Content is clearable"
    round
    clearable
  />
  <n-button size="small" @click="value = 'Content is clearable'">Fill Content</n-button>
</n-space>
export default {
  data () {
    return {
      value: null
    }
  }
}