fix: menu
parent
c2a59f7f8b
commit
35018fcac1
|
@ -39,3 +39,7 @@ okButtonProps、cancelButtonProps 扁平化处理
|
||||||
## Mentions
|
## Mentions
|
||||||
|
|
||||||
v-model -> v-model:value
|
v-model -> v-model:value
|
||||||
|
|
||||||
|
## menu
|
||||||
|
|
||||||
|
v-model -> v-model:selectedKeys :openKeys.sync -> v-mdoel:openKeys
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import shallowEqual from 'shallowequal';
|
import shallowEqual from 'shallowequal';
|
||||||
import { inject, createVNode, watchEffect } from 'vue';
|
import { inject, createVNode, watchEffect, toRaw } from 'vue';
|
||||||
import omit from 'omit.js';
|
import omit from 'omit.js';
|
||||||
import { getOptionProps } from '../props-util';
|
import { getOptionProps } from '../props-util';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export default function connect(mapStateToProps) {
|
||||||
const nextSubscribed = finnalMapStateToProps(this.store.getState(), props);
|
const nextSubscribed = finnalMapStateToProps(this.store.getState(), props);
|
||||||
if (
|
if (
|
||||||
!shallowEqual(this.preProps, props) ||
|
!shallowEqual(this.preProps, props) ||
|
||||||
!shallowEqual(this.subscribed, nextSubscribed)
|
!shallowEqual(toRaw(this.subscribed), nextSubscribed)
|
||||||
) {
|
) {
|
||||||
this.subscribed = nextSubscribed;
|
this.subscribed = nextSubscribed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ exports[`Button renders Chinese characters correctly 4`] = `<button class="ant-b
|
||||||
exports[`Button renders Chinese characters correctly 5`] = `<button class="ant-btn ant-btn-loading" type="button"><span class="anticon anticon-loading" role="img" aria-label="loading"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span>按 钮</span></button>`;
|
exports[`Button renders Chinese characters correctly 5`] = `<button class="ant-btn ant-btn-loading" type="button"><span class="anticon anticon-loading" role="img" aria-label="loading"><svg class="anticon-spin" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span><span>按 钮</span></button>`;
|
||||||
|
|
||||||
exports[`Button renders Chinese characters correctly 6`] = `
|
exports[`Button renders Chinese characters correctly 6`] = `
|
||||||
<button class="ant-btn" type="button">
|
<button class="ant-btn ant-btn-two-chinese-chars" type="button">
|
||||||
<!----><span>按 钮</span></button>
|
<!----><span>按钮</span></button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Button renders correctly 1`] = `
|
exports[`Button renders correctly 1`] = `
|
||||||
|
|
|
@ -191,7 +191,7 @@ describe('Button', () => {
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
fit('fixbug renders {0} , 0 and {false}', () => {
|
it('fixbug renders {0} , 0 and {false}', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render() {
|
render() {
|
||||||
return <Button>{0}</Button>;
|
return <Button>{0}</Button>;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import omit from 'omit.js';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import VcMentions from '../vc-mentions';
|
import VcMentions from '../vc-mentions';
|
||||||
import { mentionsProps } from '../vc-mentions/src/mentionsProps';
|
import { mentionsProps } from '../vc-mentions/src/mentionsProps';
|
||||||
import Base from '../base';
|
|
||||||
import Spin from '../spin';
|
import Spin from '../spin';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
@ -171,7 +170,6 @@ const Mentions = {
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
Mentions.install = function(app) {
|
Mentions.install = function(app) {
|
||||||
app.use(Base);
|
|
||||||
app.component(Mentions.name, Mentions);
|
app.component(Mentions.name, Mentions);
|
||||||
app.component(Mentions.Option.name, Mentions.Option);
|
app.component(Mentions.Option.name, Mentions.Option);
|
||||||
};
|
};
|
||||||
|
|
|
@ -288,7 +288,6 @@ const DOMWrap = {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const Tag = this.$props.tag;
|
const Tag = this.$props.tag;
|
||||||
|
|
||||||
return <Tag>{this.renderChildren(getSlot(this))}</Tag>;
|
return <Tag>{this.renderChildren(getSlot(this))}</Tag>;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -445,7 +445,7 @@ const SubMenu = {
|
||||||
let mouseEvents = {};
|
let mouseEvents = {};
|
||||||
let titleClickEvents = {};
|
let titleClickEvents = {};
|
||||||
let titleMouseEvents = {};
|
let titleMouseEvents = {};
|
||||||
if (props.disabled === false) {
|
if (!props.disabled) {
|
||||||
mouseEvents = {
|
mouseEvents = {
|
||||||
onMouseleave: this.onMouseLeave,
|
onMouseleave: this.onMouseLeave,
|
||||||
onMouseenter: this.onMouseEnter,
|
onMouseenter: this.onMouseEnter,
|
||||||
|
|
|
@ -7,7 +7,13 @@ import classNames from 'classnames';
|
||||||
import { getKeyFromChildrenIndex, loopMenuItem, noop, isMobileDevice, menuAllProps } from './util';
|
import { getKeyFromChildrenIndex, loopMenuItem, noop, isMobileDevice, menuAllProps } from './util';
|
||||||
import DOMWrap from './DOMWrap';
|
import DOMWrap from './DOMWrap';
|
||||||
import { cloneElement } from '../_util/vnode';
|
import { cloneElement } from '../_util/vnode';
|
||||||
import { initDefaultProps, getOptionProps, getComponent, splitAttrs } from '../_util/props-util';
|
import {
|
||||||
|
initDefaultProps,
|
||||||
|
getOptionProps,
|
||||||
|
getComponent,
|
||||||
|
splitAttrs,
|
||||||
|
getPropsData,
|
||||||
|
} from '../_util/props-util';
|
||||||
|
|
||||||
function allDisabled(arr) {
|
function allDisabled(arr) {
|
||||||
if (!arr.length) {
|
if (!arr.length) {
|
||||||
|
@ -45,12 +51,8 @@ export function getActiveKey(props, originalActiveKey) {
|
||||||
if (activeKey !== undefined && activeKey !== null) {
|
if (activeKey !== undefined && activeKey !== null) {
|
||||||
let found;
|
let found;
|
||||||
loopMenuItem(children, (c, i) => {
|
loopMenuItem(children, (c, i) => {
|
||||||
const propsData = c.props || {};
|
const propsData = getPropsData(c);
|
||||||
if (
|
if (c && !propsData.disabled && activeKey === getKeyFromChildrenIndex(c, eventKey, i)) {
|
||||||
c &&
|
|
||||||
propsData.disabled !== false &&
|
|
||||||
activeKey === getKeyFromChildrenIndex(c, eventKey, i)
|
|
||||||
) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -61,9 +63,9 @@ export function getActiveKey(props, originalActiveKey) {
|
||||||
activeKey = null;
|
activeKey = null;
|
||||||
if (defaultActiveFirst) {
|
if (defaultActiveFirst) {
|
||||||
loopMenuItem(children, (c, i) => {
|
loopMenuItem(children, (c, i) => {
|
||||||
const propsData = c.props || {};
|
const propsData = getPropsData(c);
|
||||||
const noActiveKey = activeKey === null || activeKey === undefined;
|
const noActiveKey = activeKey === null || activeKey === undefined;
|
||||||
if (noActiveKey && c && propsData.disabled !== false) {
|
if (noActiveKey && c && !propsData.disabled) {
|
||||||
activeKey = getKeyFromChildrenIndex(c, eventKey, i);
|
activeKey = getKeyFromChildrenIndex(c, eventKey, i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -412,7 +412,7 @@ export default {
|
||||||
...createRefHooks(this.savePopup),
|
...createRefHooks(this.savePopup),
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Popup ref="popup" key="ddd" {...popupProps}>
|
<Popup ref="popup" {...popupProps}>
|
||||||
{getComponent(self, 'popup')}
|
{getComponent(self, 'popup')}
|
||||||
</Popup>
|
</Popup>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<a-button><span>按钮</span></a-button>
|
||||||
<demo />
|
<demo />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import demo from '../antdv-demo/docs/menu/demo/horizontal';
|
import demo from '../antdv-demo/docs/menu/demo/inline';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import '@babel/polyfill';
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import Avatar from 'ant-design-vue/avatar';
|
import Avatar from 'ant-design-vue/avatar';
|
||||||
import Breadcrumb from 'ant-design-vue/breadcrumb';
|
// import Breadcrumb from 'ant-design-vue/breadcrumb';
|
||||||
import Button from 'ant-design-vue/button';
|
import Button from 'ant-design-vue/button';
|
||||||
import Comment from 'ant-design-vue/comment';
|
import Comment from 'ant-design-vue/comment';
|
||||||
import Drawer from 'ant-design-vue/drawer';
|
import Drawer from 'ant-design-vue/drawer';
|
||||||
|
@ -49,7 +49,7 @@ app
|
||||||
.component('CN', { ...basic })
|
.component('CN', { ...basic })
|
||||||
.component('US', { ...basic })
|
.component('US', { ...basic })
|
||||||
.use(Avatar)
|
.use(Avatar)
|
||||||
.use(Breadcrumb)
|
// .use(Breadcrumb)
|
||||||
.use(Button)
|
.use(Button)
|
||||||
.use(Comment)
|
.use(Comment)
|
||||||
.use(ConfigProvider)
|
.use(ConfigProvider)
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
"vue-template-compiler": ">=2.6.0"
|
"vue-template-compiler": ">=2.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ant-design-vue/babel-plugin-jsx": "^1.0.0-alpha.5",
|
"@ant-design-vue/babel-plugin-jsx": "1.0.0-alpha.4",
|
||||||
"@babel/cli": "^7.8.4",
|
"@babel/cli": "^7.8.4",
|
||||||
"@babel/core": "^7.9.6",
|
"@babel/core": "^7.9.6",
|
||||||
"@babel/runtime": "^7.10.1",
|
"@babel/runtime": "^7.10.1",
|
||||||
|
|
Loading…
Reference in New Issue