Skip to content

Instantly share code, notes, and snippets.

@BHEADRICK
Created March 28, 2018 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BHEADRICK/222449e77f18b8d6d49bfbcd5fdaf083 to your computer and use it in GitHub Desktop.
Save BHEADRICK/222449e77f18b8d6d49bfbcd5fdaf083 to your computer and use it in GitHub Desktop.
<template>
<div v-bind:class="'form-group control-group ' + wrapperClass">
<span class="required-lbl pull-left" v-if="required">* </span>
<label class="control-label">{{ label }}</label>
<div class="controls">
<div v-bind:class="rightAddon || leftAddon?'input-group':''">
<span v-if="rightAddon" class="input-group-addon">{{rightAddon}}</span>
<input v-bind:type="type" @input="updateInput($event.target.value)" class="form-control"
v-bind:required="required" :value="value" v-bind:placeholder="placeholder">
<span v-if="leftAddon" class="input-group-addon">{{leftAddon}}</span>
</div>
<p class="help-block"><a v-if="helphref" v-bind:href="helphref" target="_blank"> {{help}}</a> <span
v-if="!helphref">{{help}}</span></p>
</div>
</div>
</template>
<script>
export default {
props:
{
label: String,
placeholder: String,
type: {
type: String,
value: String,
default: 'text'
},
required: String,
help: String,
helphref: String,
value: null,
leftAddon: String,
rightAddon: String,
wrapperClass:
{
type: String,
default: 'col-md-12'
}
},
methods:
{
updateInput(val) {
this.$emit('input', val)
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment