mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types(Picker): add method types
This commit is contained in:
parent
d2bb9fa81b
commit
46d2b09447
@ -79,34 +79,40 @@ export default createComponent({
|
||||
return this.children[index];
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// get column value by index
|
||||
getColumnValue(index) {
|
||||
const column = this.getColumn(index);
|
||||
return column && column.getValue();
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// set column value by index
|
||||
setColumnValue(index, value) {
|
||||
const column = this.getColumn(index);
|
||||
column && column.setValue(value);
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// get column option index by column index
|
||||
getColumnIndex(columnIndex) {
|
||||
return (this.getColumn(columnIndex) || {}).currentIndex;
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// set column option index by column index
|
||||
setColumnIndex(columnIndex, optionIndex) {
|
||||
const column = this.getColumn(columnIndex);
|
||||
column && column.setIndex(optionIndex);
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// get options of column by index
|
||||
getColumnValues(index) {
|
||||
return (this.children[index] || {}).options;
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// set options of column by index
|
||||
setColumnValues(index, options) {
|
||||
const column = this.children[index];
|
||||
@ -119,11 +125,13 @@ export default createComponent({
|
||||
}
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// get values of all columns
|
||||
getValues() {
|
||||
return this.children.map(child => child.getValue());
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// set values of all columns
|
||||
setValues(values) {
|
||||
values.forEach((value, index) => {
|
||||
@ -131,11 +139,13 @@ export default createComponent({
|
||||
});
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// get indexes of all columns
|
||||
getIndexes() {
|
||||
return this.children.map(child => child.currentIndex);
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
// set indexes of all columns
|
||||
setIndexes(indexes) {
|
||||
indexes.forEach((optionIndex, columnIndex) => {
|
||||
|
6
types/index.d.ts
vendored
6
types/index.d.ts
vendored
@ -14,6 +14,8 @@ import { Lazyload } from './lazyload';
|
||||
import { List } from './list';
|
||||
import { Locale } from './locale';
|
||||
import { Notify } from './notify';
|
||||
import { Picker } from './picker';
|
||||
import { Sku } from './sku';
|
||||
import { Swipe } from './swipe';
|
||||
import { SwipeCell } from './swipe-cell';
|
||||
import { Tabs } from './tabs';
|
||||
@ -59,7 +61,6 @@ export class Overlay extends VanComponent {}
|
||||
export class Pagination extends VanComponent {}
|
||||
export class Panel extends VanComponent {}
|
||||
export class PasswordInput extends VanComponent {}
|
||||
export class Picker extends VanComponent {}
|
||||
export class Popup extends VanComponent {}
|
||||
export class Progress extends VanComponent {}
|
||||
export class PullRefresh extends VanComponent {}
|
||||
@ -71,7 +72,6 @@ export class Search extends VanComponent {}
|
||||
export class Sidebar extends VanComponent {}
|
||||
export class SidebarItem extends VanComponent {}
|
||||
export class Skeleton extends VanComponent {}
|
||||
export class Sku extends VanComponent {}
|
||||
export class Slider extends VanComponent {}
|
||||
export class Step extends VanComponent {}
|
||||
export class Stepper extends VanComponent {}
|
||||
@ -101,6 +101,8 @@ export {
|
||||
List,
|
||||
Locale,
|
||||
Notify,
|
||||
Picker,
|
||||
Sku,
|
||||
Swipe,
|
||||
SwipeCell,
|
||||
Tabs,
|
||||
|
23
types/picker.d.ts
vendored
Normal file
23
types/picker.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import { VanComponent } from './component';
|
||||
|
||||
export class Picker extends VanComponent {
|
||||
getValues(): string[];
|
||||
|
||||
setValues(values: string[]): void;
|
||||
|
||||
getIndexes(): number[];
|
||||
|
||||
setIndexes(indexes: number[]): void;
|
||||
|
||||
getColumnValue(columnIndex: number): string;
|
||||
|
||||
setColumnValue(columnIndex: number, value: string): void;
|
||||
|
||||
getColumnIndex(columnIndex: number): number;
|
||||
|
||||
setColumnIndex(columnIndex: number, optionIndex: number): void;
|
||||
|
||||
getColumnValues(columnIndex: number): string[];
|
||||
|
||||
setColumnValues(columnIndex: number, values: string[]): void;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user