<template>
<div>
<input :type="type" :value="value" @input="myinput" />
</div>
</template>
<script>
export default {
props: {
type: {
type: String,
default: "text",
},
value: {
type: String,
default: "",
},
},
methods: {
myinput(ev) {
this.$emit("input", ev.target.value);
},
},
};
</script>
<style scoped>
</style>
KInput 组件
使用起来非常简单
只要实现了value 和@input 就可以实现v-model 了