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
src/components/input/input.vue
| ... | ... | @@ -161,6 +161,17 @@ |
| 161 | 161 | const maxRows = autosize.maxRows; |
| 162 | 162 | |
| 163 | 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 | 177 | watch: { |
| ... | ... | @@ -171,16 +182,8 @@ |
| 171 | 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 | 189 | </script> | ... | ... |
src/components/select/dropdown.vue
src/components/table/cell.vue
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | const cell = document.createElement('div'); |
| 51 | 51 | cell.innerHTML = template; |
| 52 | 52 | const _oldParentChildLen = $parent.$children.length; |
| 53 | - $parent.$compile(cell); | |
| 53 | + $parent.$compile(cell); // todo 这里无法触发 ready 钩子 | |
| 54 | 54 | const _newParentChildLen = $parent.$children.length; |
| 55 | 55 | |
| 56 | 56 | if (_oldParentChildLen !== _newParentChildLen) { // if render normal html node, do not tag | ... | ... |
src/styles/components/date-picker.less
test/routers/input.vue
| 1 | 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 | 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 | 5 | <i-input icon="ios-clock-outline" style="width:200px;" :value.sync="v" @on-enter="enter" placeholder="请输入"></i-input> |
| 4 | 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 | 1 | <template> |
| 2 | 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 | 13 | </div> |
| 13 | 14 | </template> |
| 14 | 15 | <script> |
| 15 | 16 | export default { |
| 16 | 17 | data () { |
| 17 | 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 | 98 | columns1: [ |
| 19 | 99 | { |
| 20 | 100 | title: '姓名', | ... | ... |