bmui
Version:
Bluemoon Moon Components
165 lines (157 loc) • 4.16 kB
JavaScript
import MixinInput from '../mixins/input';
var __render = function __render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
staticClass: "bmui-field_text2",
on: {
"click": _vm.mixinInputDoFocus
}
}, [_c('p', {
staticClass: "bmui-field_text2-title"
}, [_vm._v(_vm._s(_vm.title || 'TITLE')), _c('span', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.isNeed,
expression: "isNeed"
}],
staticClass: "bmui-field_text2-isNeed"
}, [_vm._v("*")])]), _vm._v(" "), _c('div', {
staticClass: "bmui-field_text2-wrap"
}, [_vm.$slots["default"] ? _c('div', {
staticClass: "bmui-field_text2-input",
"class": {
'bmui-field_text2-empty': !_vm.valueInside
}
}, [_vm._t("default")], 2) : _vm.mixinInputProps.type === 'checkbox' ? _c('input', _vm._b({
directives: [{
name: "model",
rawName: "v-model",
value: _vm.valueInside,
expression: "valueInside"
}],
ref: "input",
staticClass: "bmui-field_text2-input",
"class": {
'bmui-field_text1-empty': !_vm.valueInside
},
attrs: {
"placeholder": _vm.placeholder || '请输入',
"type": "checkbox"
},
domProps: {
"checked": Array.isArray(_vm.valueInside) ? _vm._i(_vm.valueInside, null) > -1 : _vm.valueInside
},
on: {
"change": function change($event) {
var $a = _vm.valueInside,
$el = $event.target,
$c = $el.checked ? true : false;
if (Array.isArray($a)) {
var $v = null,
$i = _vm._i($a, $v);
if ($el.checked) {
$i < 0 && (_vm.valueInside = $a.concat([$v]));
} else {
$i > -1 && (_vm.valueInside = $a.slice(0, $i).concat($a.slice($i + 1)));
}
} else {
_vm.valueInside = $c;
}
}
}
}, 'input', _vm.mixinInputProps, false)) : _vm.mixinInputProps.type === 'radio' ? _c('input', _vm._b({
directives: [{
name: "model",
rawName: "v-model",
value: _vm.valueInside,
expression: "valueInside"
}],
ref: "input",
staticClass: "bmui-field_text2-input",
"class": {
'bmui-field_text1-empty': !_vm.valueInside
},
attrs: {
"placeholder": _vm.placeholder || '请输入',
"type": "radio"
},
domProps: {
"checked": _vm._q(_vm.valueInside, null)
},
on: {
"change": function change($event) {
_vm.valueInside = null;
}
}
}, 'input', _vm.mixinInputProps, false)) : _c('input', _vm._b({
directives: [{
name: "model",
rawName: "v-model",
value: _vm.valueInside,
expression: "valueInside"
}],
ref: "input",
staticClass: "bmui-field_text2-input",
"class": {
'bmui-field_text1-empty': !_vm.valueInside
},
attrs: {
"placeholder": _vm.placeholder || '请输入',
"type": _vm.mixinInputProps.type
},
domProps: {
"value": _vm.valueInside
},
on: {
"input": function input($event) {
if ($event.target.composing) {
return;
}
_vm.valueInside = $event.target.value;
}
}
}, 'input', _vm.mixinInputProps, false)), _vm._v(" "), _vm.valueInside ? _c('button', {
staticClass: "bmui-field_text2-del",
attrs: {
"type": "button"
},
on: {
"click": function click($event) {
$event.stopPropagation();
_vm.valueInside = '';
}
}
}) : _vm._e(), _vm._v(" "), _c('i', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.selectable && !_vm.valueInside,
expression: "selectable && !valueInside"
}],
staticClass: "bmui-field_text2-arrow"
})])]);
};
var __staticRender = [];
export default {
render: __render,
staticRenderFns: __staticRender,
name: 'BmuiFieldText2',
mixins: [MixinInput],
props: {
title: {
type: String,
"default": ''
},
selectable: {
type: Boolean,
"default": false
},
isNeed: {
type: Boolean,
"default": false
}
}
};