naive-ui/demo/documentation/components/input/enUS/event.md
2020-02-04 20:45:34 +08:00

935 B

Event

<n-input
  v-model="value"
  @blur="handleBlur"
  @focus="handleFocus"
  @change="handleChange"
  @keyup="handleKeyUp"
  @input="handleInput"
  placeholder="Operate to trigger events"
/>
<n-input
  v-model="value"
  type="textarea"
  @blur="handleBlur"
  @focus="handleFocus"
  @change="handleChange"
  @keyup="handleKeyUp"
  @input="handleInput"
  placeholder="Operate to trigger events"
/>
export default {
  data() {
    return {
      value: null,
      pair: null
    }
  },
  methods: {
    handleFocus() {
      this.$NMessage.info("[Event focus]")
    },
    handleBlur() {
      this.$NMessage.info("[Event blur]")
    },
    handleChange(v) {
      this.$NMessage.info("[Event change]" + v)
    },
    handleKeyUp(e) {
      this.$NMessage.info("[Event keyup]")
    },
    handleInput(v) {
      this.$NMessage.info("[Event input] " + v)
    }
  }
}
.n-input {
  margin-bottom: 8px;
}