面试题答案
一键面试<template>
<div>
<input v-model="inputValue" />
<p>{{ tip }}</p>
</div>
</template>
<script>
export default {
data() {
return {
inputValue: ''
};
},
computed: {
tip() {
const length = this.inputValue.length;
if (length < 5) {
return '太短';
} else if (length < 10) {
return '适中';
} else {
return '太长';
}
}
}
};
</script>