kui-vue 3.2.8-rc3 → 3.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,18 +8,25 @@
8
8
  <template>
9
9
  <div>
10
10
  <Button @click="show=!show">普通抽屉</Button>
11
+ <Button @click="show2=!show2">Width 30%</Button>
11
12
  <Drawer v-model="show" :closable="false" :footer="null" :title="null">
12
13
  <p>something ...</p>
13
14
  <p>something ...</p>
14
15
  <p>something ...</p>
15
16
  </Drawer>
17
+ <Drawer v-model="show2" width="30%" title="Width 30%">
18
+ <p>something ...</p>
19
+ <p>something ...</p>
20
+ <p>something ...</p>
21
+ </Drawer>
16
22
  </div>
17
23
  </template>
18
24
  <script>
19
25
  export default{
20
26
  data(){
21
27
  return{
22
- show:false
28
+ show:false,
29
+ show2:false
23
30
  }
24
31
  }
25
32
  }
@@ -13,7 +13,7 @@
13
13
  <Radio label="bottom" value="bottom"/>
14
14
  </RadioGroup>
15
15
  <Button @click="show=true" >Open</Button>
16
- <Drawer v-model="show" width="300" :placement="placement" title="What's your name? " cancelText="Cancel" okText="Ok">My name is chuchur.</Drawer>
16
+ <Drawer v-model="show" height="300" :placement="placement" title="What's your name? " cancelText="Cancel" okText="Ok">My name is chuchur.</Drawer>
17
17
  </div>
18
18
  </template>
19
19
  <script>
@@ -28,6 +28,7 @@ export default {
28
28
  this.rendered = true
29
29
  this.$nextTick(e => {
30
30
  this.visible = v
31
+ this.openHandle()
31
32
  this.resetBodyStyle(v)
32
33
  })
33
34
  },
@@ -35,7 +36,8 @@ export default {
35
36
  data() {
36
37
  return {
37
38
  visible: this.value,
38
- rendered: this.value
39
+ rendered: this.value,
40
+ open: this.value
39
41
  };
40
42
  },
41
43
  beforeDestroy() {
@@ -54,11 +56,21 @@ export default {
54
56
  this.$emit("cancel");
55
57
  this.close();
56
58
  },
59
+ openHandle() {
60
+ if (this.visible) {
61
+ this.open = true
62
+ } else {
63
+ setTimeout(() => {
64
+ this.open = false
65
+ }, 300);
66
+ }
67
+ },
57
68
  close() {
58
69
  this.visible = false;
59
70
  this.$emit("input", false);
60
71
  this.$emit("cancel");
61
72
  this.$emit("close");
73
+ this.openHandle()
62
74
  },
63
75
  maskToClose() {
64
76
  if (this.maskClosable) {
@@ -67,7 +79,7 @@ export default {
67
79
  },
68
80
  resetBodyStyle(opened) {
69
81
  let target = this.target();
70
- if (!this.visible && !cacheBodyOverflow.hasOwnProperty('overflow')) {
82
+ if (opened && !cacheBodyOverflow.hasOwnProperty('overflow')) {
71
83
  cacheBodyOverflow = {
72
84
  width: target.style.width,
73
85
  overflow: target.style.overflow,
@@ -77,7 +89,8 @@ export default {
77
89
  }
78
90
  if (opened) {
79
91
  let barWidth = measureScrollBar(true)
80
- let hasBar = target.scrollHeight > target.clientHeight || target.offsetHeight > target.clientHeight
92
+ let el = target == document.body ? document.documentElement : target
93
+ let hasBar = el.scrollHeight > el.clientHeight || el.offsetHeight > el.clientHeight
81
94
  if (barWidth && hasBar) {
82
95
  target.style.width = `calc(100% - ${barWidth}px)`
83
96
  target.style.overflow = `hidden`
@@ -95,7 +108,7 @@ export default {
95
108
  render() {
96
109
  if (this.$isServer) return null;
97
110
  const { title, visible, cancelText, okText, ok,
98
- placement, cancel, $slots,
111
+ placement, cancel, $slots, width, height, open,
99
112
  closable, close, } = this
100
113
  const hasFooter = this.footer || $slots.footer
101
114
  const canelBtn = <Button onClick={cancel}>{cancelText || t('k.drawer.cancel')}</Button>
@@ -113,14 +126,14 @@ export default {
113
126
  const target = this.target()
114
127
  const inbody = target == document.body
115
128
  const classes = ['k-drawer', `k-drawer-${placement}`,
116
- { 'k-drawer-open': visible },
129
+ { 'k-drawer-open': open },
117
130
  { 'k-drawer-has-footer': hasFooter },
118
131
  { 'k-drawer-nobody': !inbody },
119
132
  { 'k-drawer-nomask': !this.mask },
120
133
  ]
121
134
  let styles = {}
122
- if (placement == 'left' || placement == 'right') styles.width = this.width + 'px'
123
- if (placement == 'top' || placement == 'bottom') styles.height = this.height + 'px'
135
+ if (placement == 'left' || placement == 'right') styles.width = /%/.test(width) ? width : width + 'px'
136
+ if (placement == 'top' || placement == 'bottom') styles.height = /%/.test(height) ? height : height + 'px'
124
137
  // const wrapCls =
125
138
  let maskNode = null
126
139
  if (this.mask) {
@@ -131,7 +144,7 @@ export default {
131
144
  return (
132
145
  this.rendered ? <div class={classes} v-transfer={target}>
133
146
  {maskNode}
134
- <transition name={transitionName} time={50000}>
147
+ <transition name={transitionName} time={3500000}>
135
148
  <div class="k-drawer-box" v-show={visible} style={styles}>
136
149
  <div class="k-drawer-content">
137
150
  {closeNode}
@@ -1,13 +1,13 @@
1
1
  #### API
2
2
  | 属性 | 说明 | 类型 | 默认值 |
3
- |--------------|--------------------------------------------------------------------|---------------|--------|
4
- | title | 抽屉标题,为null或false时不显示标题 | String | - |
5
- | width | 抽屉宽度 `placement`为 `left` 或 `right` 时使用 | Number,String | 520 |
6
- | height | 抽屉高度 `placement`为 `top` 或 `bottom` 时使用 | Number,String | 256 |
3
+ | ------------ | ------------------------------------------------------------------ | ------------- | ------ |
4
+ | title | 抽屉标题,为null或false时不显示标题 | String | - |
5
+ | width | 抽屉宽度 `placement`为 `left` 或 `right` 时使用,支持百分比 | Number,String | 520 |
6
+ | height | 抽屉高度 `placement`为 `top` 或 `bottom` 时使用,支持百分比 | Number,String | 256 |
7
7
  | placement | 抽屉显示方向,提供 `left` , `top` , `right` , `bottom` 4种展示方式 | String | right |
8
8
  | footer | 页脚内容,不显示页脚设置`footer=null`即可 | slot | true |
9
9
  | closable | 是否显示关闭按钮 | Boolean | true |
10
- | target | 展示的父元素 | Function | - |
10
+ | target | 展示的父元素 | Function | - |
11
11
  | mas-closable | 点击蒙层是否允许关闭 | Boolean | true |
12
12
  | okText | 确定按钮文字 | String | 确定 |
13
13
  | cancelText | 取消按钮文字 | String | 取消 |
@@ -15,6 +15,7 @@
15
15
  to {
16
16
  opacity: 0;
17
17
  transform: translate3d(100%, 0, 0);
18
+ // transform: translateX(100%)
18
19
  }
19
20
  }
20
21
 
@@ -21,6 +21,7 @@
21
21
  outline: 0;
22
22
  pointer-events: all;
23
23
  width: 520px; // animation: fadeIn .5s ease-in-out;
24
+ // transition: transform .3s;
24
25
  }
25
26
  .k-drawer-content {
26
27
  position: relative;
@@ -30,18 +30,25 @@ export default {
30
30
  watch: {
31
31
  pageSize(v) {
32
32
  this.defaultPageSize = v
33
+ this.resetPage()
33
34
  },
34
35
  current(v) {
35
- this.page = v
36
+ this.resetPage()
36
37
  },
37
38
  total(v) {
38
- this.pageCount = Math.ceil(this.total / this.defaultPageSize) || 1;
39
+ this.resetPage()
39
40
  }
40
41
  },
41
42
  mounted() {
42
43
  this.pageCount = Math.ceil(this.total / this.defaultPageSize) || 1;
43
44
  },
44
45
  methods: {
46
+ resetPage() {
47
+ this.pageCount = Math.ceil(this.total / this.defaultPageSize) || 1;
48
+ if (this.page > this.pageCount) {
49
+ this.page = this.pageCount
50
+ }
51
+ },
45
52
  renderPage() {
46
53
  const groupCount = 7,
47
54
  page = Number(this.page),
@@ -37,7 +37,12 @@ export default {
37
37
  ],
38
38
  cities:'wuhan'
39
39
  };
40
- }
40
+ },
41
+ methods: {
42
+ change(item){
43
+ console.log(item)
44
+ }
45
+ },
41
46
  }
42
47
  </script>
43
48
  ```
@@ -12,7 +12,7 @@
12
12
  <Button @click="select=''" size="small">Clear</Button>
13
13
  <Button @click="select=1" size="small">Choose orange</Button>
14
14
  <br />
15
- <Select :width="200">
15
+ <Select :width="200" placeholder="Please Choose">
16
16
  <Option :value="1" label="Apple" />
17
17
  <Option :value="2" label="Orange" />
18
18
  <Option :value="3" label="Banana" disabled/>
@@ -328,10 +328,10 @@ export default {
328
328
  }
329
329
  }
330
330
  }
331
- let overlay = <Drop {...props}>{this.loading ? loadingNode : (!childs.length ? <Empty onClick={this.emptyClick} description={this.emptyText}/> : <ul>{childs}</ul>)}</Drop>
331
+ let overlay = <Drop {...props}>{this.loading ? loadingNode : (!childs.length ? <Empty onClick={this.emptyClick} description={this.emptyText} /> : <ul>{childs}</ul>)}</Drop>
332
332
 
333
333
  label = multiple ? (label || []) : label
334
- placeholder = t('k.select.placeholder')
334
+ placeholder = placeholder || t('k.select.placeholder')
335
335
  const placeNode = ((placeholder && ((!label || !label.length) && !queryKey))
336
336
  ? <div class="k-select-placeholder">{placeholder}</div>
337
337
  : null
package/dist/k-ui.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * kui-vue v3.2.8rc3
2
+ * kui-vue v3.2.9
3
3
  * Copyright 2017-present, kui-vue.
4
4
  * All rights reserved.
5
5
  * Author: chuchur@qq.com / www.chuchur.com