2019-05-12 13:46:20 +02:00
|
|
|
<template>
|
2019-05-24 05:29:04 +02:00
|
|
|
<div class="form-group"
|
|
|
|
v-bind:class="{ 'has-error': hasError()}"
|
|
|
|
>
|
2019-05-12 13:46:20 +02:00
|
|
|
<div class="col-sm-12 text-sm">
|
|
|
|
{{ title }}
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<input type="text" class="form-control" :name="name"
|
|
|
|
:title="title" autocomplete="off"
|
|
|
|
ref="str"
|
|
|
|
:value="value" @input="handleInput"
|
|
|
|
:placeholder="title">
|
2019-05-24 05:29:04 +02:00
|
|
|
<ul class="list-unstyled" v-for="error in this.error">
|
|
|
|
<li class="text-danger">{{ error }}</li>
|
|
|
|
</ul>
|
2019-05-12 13:46:20 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "CustomString",
|
|
|
|
props: {
|
|
|
|
title: String,
|
|
|
|
name: String,
|
2019-05-24 05:29:04 +02:00
|
|
|
value: String,
|
|
|
|
error: Array
|
2019-05-12 13:46:20 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleInput(e) {
|
|
|
|
this.$emit('input', this.$refs.str.value);
|
2019-05-24 05:29:04 +02:00
|
|
|
},
|
|
|
|
hasError: function () {
|
|
|
|
return this.error.length > 0;
|
2019-05-12 13:46:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|