form validate css
This commit is contained in:
@@ -9,16 +9,28 @@
|
||||
:name="name"
|
||||
:placeholder="placeholder"
|
||||
@blur="validate()"
|
||||
@change="() => $emit('change', currentValue)">
|
||||
@change="() => $emit('change', currentValue)"
|
||||
:class="{invalid}"
|
||||
>
|
||||
<input type="password" v-else-if="type == 'password'"
|
||||
v-model="currentValue"
|
||||
:name="name"
|
||||
:placeholder="placeholder"
|
||||
@blur="validate()"
|
||||
@change="() => $emit('change', currentValue)">
|
||||
@change="() => $emit('change', currentValue)"
|
||||
:class="{invalid}"
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.invalid {
|
||||
background-color: #fcc;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "MyInput",
|
||||
@@ -28,7 +40,8 @@ export default {
|
||||
'name',
|
||||
'placeholder',
|
||||
'type',
|
||||
'value'
|
||||
'value',
|
||||
'invalid'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user