Commit b89a982e64ecc6a7018b0c879118c8df44d9a888
1 parent
f36be426
fixed #205
fixed #205
Showing
7 changed files
with
111 additions
and
23 deletions
Show diff stats
src/components/date-picker/picker.vue
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div | 2 | <div |
3 | :class="[prefixCls]" | 3 | :class="[prefixCls]" |
4 | v-clickoutside="handleClose"> | 4 | v-clickoutside="handleClose"> |
5 | - <div v-el:reference> | 5 | + <div v-el:reference :class="[prefixCls + '-rel']"> |
6 | <slot> | 6 | <slot> |
7 | <i-input | 7 | <i-input |
8 | :class="[prefixCls + '-editor']" | 8 | :class="[prefixCls + '-editor']" |
src/components/input/input.vue
@@ -161,6 +161,17 @@ | @@ -161,6 +161,17 @@ | ||
161 | const maxRows = autosize.maxRows; | 161 | const maxRows = autosize.maxRows; |
162 | 162 | ||
163 | this.textareaStyles = calcTextareaHeight(this.$els.textarea, minRows, maxRows); | 163 | this.textareaStyles = calcTextareaHeight(this.$els.textarea, minRows, maxRows); |
164 | + }, | ||
165 | + init () { | ||
166 | + if (this.type !== 'textarea') { | ||
167 | + this.prepend = this.$els.prepend.innerHTML !== ''; | ||
168 | + this.append = this.$els.append.innerHTML !== ''; | ||
169 | + } else { | ||
170 | + this.prepend = false; | ||
171 | + this.append = false; | ||
172 | + } | ||
173 | + this.slotReady = true; | ||
174 | + this.resizeTextarea(); | ||
164 | } | 175 | } |
165 | }, | 176 | }, |
166 | watch: { | 177 | watch: { |
@@ -171,16 +182,8 @@ | @@ -171,16 +182,8 @@ | ||
171 | this.$dispatch('on-form-change', this.value); | 182 | this.$dispatch('on-form-change', this.value); |
172 | } | 183 | } |
173 | }, | 184 | }, |
174 | - ready () { | ||
175 | - if (this.type !== 'textarea') { | ||
176 | - this.prepend = this.$els.prepend.innerHTML !== ''; | ||
177 | - this.append = this.$els.append.innerHTML !== ''; | ||
178 | - } else { | ||
179 | - this.prepend = false; | ||
180 | - this.append = false; | ||
181 | - } | ||
182 | - this.slotReady = true; | ||
183 | - this.resizeTextarea(); | 185 | + compiled () { |
186 | + this.$nextTick(() => this.init()); | ||
184 | } | 187 | } |
185 | }; | 188 | }; |
186 | </script> | 189 | </script> |
src/components/select/dropdown.vue
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | popper._popper.style.transformOrigin = `center ${ origin }`; | 66 | popper._popper.style.transformOrigin = `center ${ origin }`; |
67 | } | 67 | } |
68 | }, | 68 | }, |
69 | - ready () { | 69 | + compiled () { |
70 | this.$on('on-update-popper', this.update); | 70 | this.$on('on-update-popper', this.update); |
71 | this.$on('on-destroy-popper', this.destroy); | 71 | this.$on('on-destroy-popper', this.destroy); |
72 | }, | 72 | }, |
src/components/table/cell.vue
@@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
50 | const cell = document.createElement('div'); | 50 | const cell = document.createElement('div'); |
51 | cell.innerHTML = template; | 51 | cell.innerHTML = template; |
52 | const _oldParentChildLen = $parent.$children.length; | 52 | const _oldParentChildLen = $parent.$children.length; |
53 | - $parent.$compile(cell); | 53 | + $parent.$compile(cell); // todo 这里无法触发 ready 钩子 |
54 | const _newParentChildLen = $parent.$children.length; | 54 | const _newParentChildLen = $parent.$children.length; |
55 | 55 | ||
56 | if (_oldParentChildLen !== _newParentChildLen) { // if render normal html node, do not tag | 56 | if (_oldParentChildLen !== _newParentChildLen) { // if render normal html node, do not tag |
src/styles/components/date-picker.less
@@ -4,8 +4,11 @@ | @@ -4,8 +4,11 @@ | ||
4 | @date-picker-cells-width: 196px; | 4 | @date-picker-cells-width: 196px; |
5 | 5 | ||
6 | .@{date-picker-prefix-cls} { | 6 | .@{date-picker-prefix-cls} { |
7 | - position: relative; | 7 | + //position: relative; |
8 | line-height: normal; | 8 | line-height: normal; |
9 | + &-rel{ | ||
10 | + position: relative; | ||
11 | + } | ||
9 | .@{select-dropdown-prefix-cls} { | 12 | .@{select-dropdown-prefix-cls} { |
10 | width: auto; | 13 | width: auto; |
11 | padding: 0; | 14 | padding: 0; |
test/routers/input.vue
1 | <template> | 1 | <template> |
2 | + <i-input type="textarea" :autosize="true" placeholder="请输入..."></i-input> | ||
3 | + <i-input type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入..."></i-input> | ||
2 | <i-input name="a" icon="ios-clock-outline" @on-focus="focus" @on-blur="blur" readonly style="width:200px;" :value.sync="v" @on-enter="enter" @on-click="iconclick" size="large" placeholder="请输入"></i-input> | 4 | <i-input name="a" icon="ios-clock-outline" @on-focus="focus" @on-blur="blur" readonly style="width:200px;" :value.sync="v" @on-enter="enter" @on-click="iconclick" size="large" placeholder="请输入"></i-input> |
3 | <i-input icon="ios-clock-outline" style="width:200px;" :value.sync="v" @on-enter="enter" placeholder="请输入"></i-input> | 5 | <i-input icon="ios-clock-outline" style="width:200px;" :value.sync="v" @on-enter="enter" placeholder="请输入"></i-input> |
4 | <i-input name="b" icon="ios-clock-outline" style="width:200px;" :value.sync="v" @on-enter="enter" size="small" placeholder="请输入"></i-input> | 6 | <i-input name="b" icon="ios-clock-outline" style="width:200px;" :value.sync="v" @on-enter="enter" size="small" placeholder="请输入"></i-input> |
test/routers/table.vue
1 | <template> | 1 | <template> |
2 | <div style="width: 800px"> | 2 | <div style="width: 800px"> |
3 | - <i-table width="550" height="200" border :columns="columns5" :data="data4"></i-table> | ||
4 | - <br> | ||
5 | - <i-table border height="300" :columns="columns1" :data="data1"></i-table> | ||
6 | - <br> | ||
7 | - <i-table border height="300" :columns="columns1" :data="data2"></i-table> | ||
8 | - <br> | ||
9 | - <i-table border height="300" :columns="columns2" :data="data1"></i-table> | ||
10 | - <br> | ||
11 | - <i-table border height="300" :columns="columns3" :data="data1"></i-table> | 3 | + <i-table border :content="self" :columns="columns7" :data="data6"></i-table> |
4 | + <!--<i-table width="550" height="200" border :columns="columns5" :data="data4"></i-table>--> | ||
5 | + <!--<br>--> | ||
6 | + <!--<i-table border height="300" :columns="columns1" :data="data1"></i-table>--> | ||
7 | + <!--<br>--> | ||
8 | + <!--<i-table border height="300" :columns="columns1" :data="data2"></i-table>--> | ||
9 | + <!--<br>--> | ||
10 | + <!--<i-table border height="300" :columns="columns2" :data="data1"></i-table>--> | ||
11 | + <!--<br>--> | ||
12 | + <!--<i-table border height="300" :columns="columns3" :data="data1"></i-table>--> | ||
12 | </div> | 13 | </div> |
13 | </template> | 14 | </template> |
14 | <script> | 15 | <script> |
15 | export default { | 16 | export default { |
16 | data () { | 17 | data () { |
17 | return { | 18 | return { |
19 | + self: this, | ||
20 | + cityList: [ | ||
21 | + { | ||
22 | + value: 'beijing', | ||
23 | + label: '北京市' | ||
24 | + }, | ||
25 | + { | ||
26 | + value: 'shanghai', | ||
27 | + label: '上海市' | ||
28 | + }, | ||
29 | + { | ||
30 | + value: 'shenzhen', | ||
31 | + label: '深圳市' | ||
32 | + }, | ||
33 | + { | ||
34 | + value: 'hangzhou', | ||
35 | + label: '杭州市' | ||
36 | + }, | ||
37 | + { | ||
38 | + value: 'nanjing', | ||
39 | + label: '南京市' | ||
40 | + }, | ||
41 | + { | ||
42 | + value: 'chongqing', | ||
43 | + label: '重庆市' | ||
44 | + } | ||
45 | + ], | ||
46 | + model1: '', | ||
47 | + columns7: [ | ||
48 | + { | ||
49 | + title: '姓名', | ||
50 | + key: 'name', | ||
51 | + render (row, column, index) { | ||
52 | + return `<Icon type="person"></Icon> <strong>${row.name}</strong>`; | ||
53 | + } | ||
54 | + }, | ||
55 | + { | ||
56 | + title: '年龄', | ||
57 | + key: 'age' | ||
58 | + }, | ||
59 | + { | ||
60 | + title: '地址', | ||
61 | + key: 'address' | ||
62 | + }, | ||
63 | + { | ||
64 | + title: '操作', | ||
65 | + key: 'action', | ||
66 | + width: 400, | ||
67 | + align: 'center', | ||
68 | + render (row, column, index) { | ||
69 | + return ` | ||
70 | +<Date-picker type="daterange" placement="bottom-end" placeholder="选择日期"></Date-picker> | ||
71 | +<br><br><br><br><br><br> | ||
72 | +`; | ||
73 | + } | ||
74 | + } | ||
75 | + ], | ||
76 | + data6: [ | ||
77 | + { | ||
78 | + name: '王小明', | ||
79 | + age: 18, | ||
80 | + address: '北京市朝阳区芍药居' | ||
81 | + }, | ||
82 | + { | ||
83 | + name: '张小刚', | ||
84 | + age: 25, | ||
85 | + address: '北京市海淀区西二旗' | ||
86 | + }, | ||
87 | + { | ||
88 | + name: '李小红', | ||
89 | + age: 30, | ||
90 | + address: '上海市浦东新区世纪大道' | ||
91 | + }, | ||
92 | + { | ||
93 | + name: '周小伟', | ||
94 | + age: 26, | ||
95 | + address: '深圳市南山区深南大道' | ||
96 | + } | ||
97 | + ], | ||
18 | columns1: [ | 98 | columns1: [ |
19 | { | 99 | { |
20 | title: '姓名', | 100 | title: '姓名', |