|
1 | | -<template> |
2 | | - <div |
3 | | - class="q-if row no-wrap items-end relative-position" |
4 | | - :class="classes" |
5 | | - :tabindex="focusable && !disable ? 0 : -1" |
6 | | - @click="__onClick" |
7 | | - > |
8 | | - <template v-if="before"> |
9 | | - <q-icon |
10 | | - v-for="item in before" |
11 | | - :key="`b${item.icon}`" |
12 | | - class="q-if-control q-if-control-before" |
13 | | - :class="{hidden: __additionalHidden(item, hasError, hasWarning, length)}" |
14 | | - :name="item.icon" |
15 | | - @mousedown.native="__onMouseDown" |
16 | | - @touchstart.native="__onMouseDown" |
17 | | - @click.native="__baHandler($event, item)" |
18 | | - /> |
19 | | - </template> |
20 | | - |
21 | | - <div class="q-if-inner col row no-wrap relative-position"> |
22 | | - <div |
23 | | - v-if="hasLabel" |
24 | | - class="q-if-label ellipsis full-width absolute self-start" |
25 | | - :class="{'q-if-label-above': labelIsAbove}" |
26 | | - v-html="label" |
27 | | - /> |
28 | | - |
29 | | - <span |
30 | | - v-if="prefix" |
31 | | - class="q-if-addon q-if-addon-left" |
32 | | - :class="addonClass" |
33 | | - v-html="prefix" |
34 | | - /> |
35 | | - |
36 | | - <slot/> |
37 | | - |
38 | | - <span |
39 | | - v-if="suffix" |
40 | | - class="q-if-addon q-if-addon-right" |
41 | | - :class="addonClass" |
42 | | - v-html="suffix" |
43 | | - /> |
44 | | - </div> |
45 | | - |
46 | | - <template v-if="after"> |
47 | | - <q-icon |
48 | | - v-for="item in after" |
49 | | - :key="`a${item.icon}`" |
50 | | - class="q-if-control" |
51 | | - :class="{hidden: __additionalHidden(item, hasError, hasWarning, length)}" |
52 | | - :name="item.icon" |
53 | | - @mousedown.native="__onMouseDown" |
54 | | - @touchstart.native="__onMouseDown" |
55 | | - @click.native="__baHandler($event, item)" |
56 | | - /> |
57 | | - </template> |
58 | | - <slot name="after"/> |
59 | | - </div> |
60 | | -</template> |
61 | | - |
62 | | -<script> |
63 | 1 | import FrameMixin from '../../mixins/input-frame.js' |
64 | 2 | import ParentFieldMixin from '../../mixins/parent-field.js' |
| 3 | +import QIcon from '../icon/QIcon.js' |
65 | 4 |
|
66 | 5 | export default { |
67 | 6 | name: 'QInputFrame', |
@@ -142,6 +81,78 @@ export default { |
142 | 81 | item.handler(evt) |
143 | 82 | } |
144 | 83 | } |
| 84 | + }, |
| 85 | + |
| 86 | + render (h) { |
| 87 | + return h('div', { |
| 88 | + staticClass: 'q-if row no-wrap items-end relative-position', |
| 89 | + 'class': this.classes, |
| 90 | + attrs: { tabindex: this.focusable && !this.disable ? 0 : -1 }, |
| 91 | + on: { click: this.__onClick } |
| 92 | + }, [ |
| 93 | + (this.before && this.before.map(item => { |
| 94 | + return h(QIcon, { |
| 95 | + key: `b${item.icon}`, |
| 96 | + staticClass: 'q-if-control q-if-control-before', |
| 97 | + 'class': { |
| 98 | + hidden: this.__additionalHidden(item, this.hasError, this.hasWarning, this.length) |
| 99 | + }, |
| 100 | + props: { |
| 101 | + name: item.icon |
| 102 | + }, |
| 103 | + nativeOn: { |
| 104 | + mousedown: this.__onMouseDown, |
| 105 | + touchstart: this.__onMouseDown, |
| 106 | + click: e => { this.__baHandler(e, item) } |
| 107 | + } |
| 108 | + }) |
| 109 | + })) || void 0, |
| 110 | + |
| 111 | + h('div', { |
| 112 | + staticClass: 'q-if-inner col row no-wrap relative-position' |
| 113 | + }, [ |
| 114 | + (this.hasLabel && h('div', { |
| 115 | + staticClass: 'q-if-label ellipsis full-width absolute self-start', |
| 116 | + 'class': { 'q-if-label-above': this.labelIsAbove }, |
| 117 | + domProps: { |
| 118 | + innerHTML: this.label |
| 119 | + } |
| 120 | + })) || void 0, |
| 121 | + |
| 122 | + (this.prefix && h('span', { |
| 123 | + staticClass: 'q-if-addon q-if-addon-left', |
| 124 | + 'class': this.addonClass, |
| 125 | + domProps: { |
| 126 | + innerHTML: this.prefix |
| 127 | + } |
| 128 | + })) || void 0 |
| 129 | + ].concat(this.$slots.default).concat([ |
| 130 | + (this.suffix && h('span', { |
| 131 | + staticClass: 'q-if-addon q-if-addon-right', |
| 132 | + 'class': this.addonClass, |
| 133 | + domProps: { |
| 134 | + innerHTML: this.suffix |
| 135 | + } |
| 136 | + })) || void 0 |
| 137 | + ])), |
| 138 | + |
| 139 | + (this.after && this.after.map(item => { |
| 140 | + return h(QIcon, { |
| 141 | + key: `a${item.icon}`, |
| 142 | + staticClass: 'q-if-control', |
| 143 | + 'class': { |
| 144 | + hidden: this.__additionalHidden(item, this.hasError, this.hasWarning, this.length) |
| 145 | + }, |
| 146 | + props: { |
| 147 | + name: item.icon |
| 148 | + }, |
| 149 | + nativeOn: { |
| 150 | + mousedown: this.__onMouseDown, |
| 151 | + touchstart: this.__onMouseDown, |
| 152 | + click: e => { this.__baHandler(e, item) } |
| 153 | + } |
| 154 | + }) |
| 155 | + })) || void 0 |
| 156 | + ].concat(this.$slots.after)) |
145 | 157 | } |
146 | 158 | } |
147 | | -</script> |
|
0 commit comments