用VUE写一个好看的多行文本框问卷
<template>
<div class="questionnaire">
<h2>Questionnaire</h2>
<form>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" v-model="name" placeholder="Enter your name" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" v-model="email" placeholder="Enter your email" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea id="message" v-model="message" placeholder="Enter your message" rows="5" required></textarea>
</div>
<button type="submit" class="btn">Submit</button>
</form>
</div>
</template>
<script>
export default {
data() {
return {
name: '',
email: '',
message: '',
}
},
}
</script>
<style scoped>
.questionnaire {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
border-radius: 10px;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
input,
textarea {
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
background-color: #e6e6e6;
font-size: 16px;
resize: none;
}
textarea {
height: auto;
min-height: 150px;
}
.btn {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
.btn:hover {
background-color: #3e8e41;
}
</style>
原文地址: https://www.cveoy.top/t/topic/np8 著作权归作者所有。请勿转载和采集!