Commit f89dd9c28740685deb98ec9fe3f6b144decc4d76
1 parent
cb6418ac
Paeg、Select add placement
Showing
5 changed files
with
30 additions
and
17 deletions
Show diff stats
examples/routers/page.vue
1 | <template> | 1 | <template> |
2 | - <div> | ||
3 | - <Page :total="100" :current="current"></Page> | ||
4 | - {{ current }} | ||
5 | - <Button @click="current = 1">set current</Button> | 2 | + <div style="margin: 100px;"> |
3 | + <Page :total="100" show-sizer placement="top"></Page> | ||
6 | </div> | 4 | </div> |
7 | </template> | 5 | </template> |
8 | <script> | 6 | <script> |
9 | export default { | 7 | export default { |
10 | - data () { | ||
11 | - return { | ||
12 | - current: 2 | ||
13 | - } | ||
14 | - } | 8 | + |
15 | } | 9 | } |
16 | </script> | 10 | </script> |
examples/routers/select.vue
1 | <template> | 1 | <template> |
2 | - <Select v-model="fields.pid" filterable> | ||
3 | - <Option :value="0" label="一级菜单"></Option> | ||
4 | - <Option :value="1" label="二级菜单"></Option> | ||
5 | - </Select> | 2 | + <div style="width: 200px;margin: 100px;"> |
3 | + <Select v-model="fields.pid" filterable placement="top"> | ||
4 | + <Option :value="0" label="一级菜单"></Option> | ||
5 | + <Option :value="1" label="二级菜单"></Option> | ||
6 | + </Select> | ||
7 | + </div> | ||
6 | </template> | 8 | </template> |
7 | 9 | ||
8 | <script> | 10 | <script> |
src/components/page/options.vue
1 | <template> | 1 | <template> |
2 | <div v-if="showSizer || showElevator" :class="optsClasses"> | 2 | <div v-if="showSizer || showElevator" :class="optsClasses"> |
3 | <div v-if="showSizer" :class="sizerClasses"> | 3 | <div v-if="showSizer" :class="sizerClasses"> |
4 | - <i-select v-model="currentPageSize" :size="size" @on-change="changeSize"> | 4 | + <i-select v-model="currentPageSize" :size="size" :placement="placement" @on-change="changeSize"> |
5 | <i-option v-for="item in pageSizeOpts" :key="item" :value="item" style="text-align:center;">{{ item }} {{ t('i.page.page') }}</i-option> | 5 | <i-option v-for="item in pageSizeOpts" :key="item" :value="item" style="text-align:center;">{{ item }} {{ t('i.page.page') }}</i-option> |
6 | </i-select> | 6 | </i-select> |
7 | </div> | 7 | </div> |
@@ -35,7 +35,8 @@ | @@ -35,7 +35,8 @@ | ||
35 | _current: Number, | 35 | _current: Number, |
36 | pageSize: Number, | 36 | pageSize: Number, |
37 | allPages: Number, | 37 | allPages: Number, |
38 | - isSmall: Boolean | 38 | + isSmall: Boolean, |
39 | + placement: String | ||
39 | }, | 40 | }, |
40 | data () { | 41 | data () { |
41 | return { | 42 | return { |
src/components/page/page.vue
@@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
52 | :show-sizer="showSizer" | 52 | :show-sizer="showSizer" |
53 | :page-size="currentPageSize" | 53 | :page-size="currentPageSize" |
54 | :page-size-opts="pageSizeOpts" | 54 | :page-size-opts="pageSizeOpts" |
55 | + :placement="placement" | ||
55 | :show-elevator="showElevator" | 56 | :show-elevator="showElevator" |
56 | :_current.once="currentPage" | 57 | :_current.once="currentPage" |
57 | :current="currentPage" | 58 | :current="currentPage" |
@@ -92,6 +93,12 @@ | @@ -92,6 +93,12 @@ | ||
92 | return [10, 20, 30, 40]; | 93 | return [10, 20, 30, 40]; |
93 | } | 94 | } |
94 | }, | 95 | }, |
96 | + placement: { | ||
97 | + validator (value) { | ||
98 | + return oneOf(value, ['top', 'bottom']); | ||
99 | + }, | ||
100 | + default: 'bottom' | ||
101 | + }, | ||
95 | size: { | 102 | size: { |
96 | validator (value) { | 103 | validator (value) { |
97 | return oneOf(value, ['small']); | 104 | return oneOf(value, ['small']); |
src/components/select/select.vue
@@ -24,8 +24,8 @@ | @@ -24,8 +24,8 @@ | ||
24 | <Icon type="ios-close" :class="[prefixCls + '-arrow']" v-show="showCloseIcon" @click.native.stop="clearSingleSelect"></Icon> | 24 | <Icon type="ios-close" :class="[prefixCls + '-arrow']" v-show="showCloseIcon" @click.native.stop="clearSingleSelect"></Icon> |
25 | <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']"></Icon> | 25 | <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']"></Icon> |
26 | </div> | 26 | </div> |
27 | - <transition name="slide-up"> | ||
28 | - <Drop v-show="visible" ref="dropdown"> | 27 | + <transition :name="transitionName"> |
28 | + <Drop v-show="visible" :placement="placement" ref="dropdown"> | ||
29 | <ul v-show="notFound" :class="[prefixCls + '-not-found']"><li>{{ localeNotFoundText }}</li></ul> | 29 | <ul v-show="notFound" :class="[prefixCls + '-not-found']"><li>{{ localeNotFoundText }}</li></ul> |
30 | <ul v-show="!notFound" :class="[prefixCls + '-dropdown-list']" ref="options"><slot></slot></ul> | 30 | <ul v-show="!notFound" :class="[prefixCls + '-dropdown-list']" ref="options"><slot></slot></ul> |
31 | </Drop> | 31 | </Drop> |
@@ -85,6 +85,12 @@ | @@ -85,6 +85,12 @@ | ||
85 | }, | 85 | }, |
86 | notFoundText: { | 86 | notFoundText: { |
87 | type: String | 87 | type: String |
88 | + }, | ||
89 | + placement: { | ||
90 | + validator (value) { | ||
91 | + return oneOf(value, ['top', 'bottom']); | ||
92 | + }, | ||
93 | + default: 'bottom' | ||
88 | } | 94 | } |
89 | }, | 95 | }, |
90 | data () { | 96 | data () { |
@@ -161,6 +167,9 @@ | @@ -161,6 +167,9 @@ | ||
161 | } else { | 167 | } else { |
162 | return this.notFoundText; | 168 | return this.notFoundText; |
163 | } | 169 | } |
170 | + }, | ||
171 | + transitionName () { | ||
172 | + return this.placement === 'bottom' ? 'slide-up' : 'slide-down'; | ||
164 | } | 173 | } |
165 | }, | 174 | }, |
166 | methods: { | 175 | methods: { |