fix: update dbclick to dblclick #1437

pull/1445/head
tanjinzhou 2019-11-20 15:49:31 +08:00
parent cece7332cb
commit e3f867b6b1
9 changed files with 14 additions and 14 deletions

View File

@ -88,7 +88,7 @@ Same as `customRow` `customHeaderRow` `customCell` `customHeaderCell`. Follow [V
}, },
on: { on: {
click: (event) => {}, // click row click: (event) => {}, // click row
dbclick: (event) => {}, // double click row dblclick: (event) => {}, // double click row
contextmenu: (event) => {} // right button click row contextmenu: (event) => {} // right button click row
mouseenter: (event) => {} // mouse enter row mouseenter: (event) => {} // mouse enter row
mouseleave: (event) => {} // mouse leave row mouseleave: (event) => {} // mouse leave row

View File

@ -88,7 +88,7 @@ const columns = [
}, },
on: { // 事件 on: { // 事件
click: (event) => {}, // 点击行 click: (event) => {}, // 点击行
dbclick: (event) => {}, dblclick: (event) => {},
contextmenu: (event) => {}, contextmenu: (event) => {},
mouseenter: (event) => {}, // 鼠标移入行 mouseenter: (event) => {}, // 鼠标移入行
mouseleave: (event) => {} mouseleave: (event) => {}

View File

@ -10,7 +10,7 @@ import BaseMixin from '../_util/BaseMixin';
import { initDefaultProps, getOptionProps } from '../_util/props-util'; import { initDefaultProps, getOptionProps } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
// export type ExpandAction = false | 'click' | 'dbclick'; export interface // export type ExpandAction = false | 'click' | 'dblclick'; export interface
// DirectoryTreeProps extends TreeProps { expandAction?: ExpandAction; } // DirectoryTreeProps extends TreeProps { expandAction?: ExpandAction; }
// export interface DirectoryTreeState { expandedKeys?: string[]; // export interface DirectoryTreeState { expandedKeys?: string[];
// selectedKeys?: string[]; } // selectedKeys?: string[]; }
@ -33,7 +33,7 @@ export default {
props: initDefaultProps( props: initDefaultProps(
{ {
...TreeProps(), ...TreeProps(),
expandAction: PropTypes.oneOf([false, 'click', 'doubleclick', 'dbclick']), expandAction: PropTypes.oneOf([false, 'click', 'doubleclick', 'dblclick']),
}, },
{ {
showIcon: true, showIcon: true,
@ -104,12 +104,12 @@ export default {
const { expandAction } = this.$props; const { expandAction } = this.$props;
// Expand the tree // Expand the tree
if (expandAction === 'dbclick' || expandAction === 'doubleclick') { if (expandAction === 'dblclick' || expandAction === 'doubleclick') {
this.onDebounceExpand(event, node); this.onDebounceExpand(event, node);
} }
this.$emit('doubleclick', event, node); this.$emit('doubleclick', event, node);
this.$emit('dbclick', event, node); this.$emit('dblclick', event, node);
}, },
onSelect(keys, event) { onSelect(keys, event) {
@ -185,7 +185,7 @@ export default {
const { _expandedKeys: expandedKeys, _selectedKeys: selectedKeys } = this.$data; const { _expandedKeys: expandedKeys, _selectedKeys: selectedKeys } = this.$data;
warning( warning(
!this.$listeners.doubleclick, !this.$listeners.doubleclick,
'`doubleclick` is deprecated. please use `dbclick` instead.', '`doubleclick` is deprecated. please use `dblclick` instead.',
); );
const treeProps = { const treeProps = {
props: { props: {
@ -201,7 +201,7 @@ export default {
...omit(this.$listeners, ['update:selectedKeys']), ...omit(this.$listeners, ['update:selectedKeys']),
select: this.onSelect, select: this.onSelect,
click: this.onClick, click: this.onClick,
dbclick: this.onDoubleClick, dblclick: this.onDoubleClick,
expand: this.onExpand, expand: this.onExpand,
}, },
}; };

View File

@ -66,7 +66,7 @@ One of the Tree `treeNode` prop for describing the tree's node, TreeNode has the
| Property | Description | Type | Default | | Property | Description | Type | Default |
| ------------ | ------------------------------------------------------------ | ------ | ------- | | ------------ | ------------------------------------------------------------ | ------ | ------- |
| expandAction | Directory open logic, optional `false` `'click'` `'dbclick'` | string | click | | expandAction | Directory open logic, optional `false` `'click'` `'dblclick'` | string | click |
## FAQ ## FAQ

View File

@ -66,7 +66,7 @@
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| ------------ | ------------------------------------------------ | ------ | ------ | | ------------ | ------------------------------------------------ | ------ | ------ |
| expandAction | 目录展开逻辑,可选 `false` `'click'` `'dbclick'` | string | click | | expandAction | 目录展开逻辑,可选 `false` `'click'` `'dblclick'` | string | click |
## FAQ ## FAQ

View File

@ -61,7 +61,7 @@ export default {
}, },
on: { on: {
click: onSelect, click: onSelect,
dbclick: onItemDoubleClick, dblclick: onItemDoubleClick,
mousedown: e => e.preventDefault(), mousedown: e => e.preventDefault(),
}, },
key: Array.isArray(key) ? key.join('__ant__') : key, key: Array.isArray(key) ? key.join('__ant__') : key,

View File

@ -116,7 +116,7 @@ export default {
customRow={(record, index) => ({ customRow={(record, index) => ({
on: { on: {
click: onRowClick.bind(null, record, index), click: onRowClick.bind(null, record, index),
dbclick: onRowDoubleClick.bind(null, record, index), dblclick: onRowDoubleClick.bind(null, record, index),
}, },
})} })}
/> />

View File

@ -380,7 +380,7 @@ const Tree = {
}, },
onNodeDoubleClick(e, treeNode) { onNodeDoubleClick(e, treeNode) {
this.__emit('dbclick', e, treeNode); this.__emit('dblclick', e, treeNode);
}, },
onNodeSelect(e, treeNode) { onNodeSelect(e, treeNode) {

View File

@ -7,7 +7,7 @@ import { Tree } from './tree';
export declare class DictionaryTree extends Tree { export declare class DictionaryTree extends Tree {
/** /**
* Directory open logic, optional false 'click' 'doubleclick' * Directory open logic, optional false 'click' 'dblclick'
* @default 'click' * @default 'click'
* @type string * @type string
*/ */