fix: menu
parent
a53768fa9a
commit
e60d535884
|
@ -195,15 +195,28 @@ const getAllProps = ele => {
|
||||||
if (ele.$) {
|
if (ele.$) {
|
||||||
props = { ...props, ...this.$attrs };
|
props = { ...props, ...this.$attrs };
|
||||||
} else {
|
} else {
|
||||||
props = { ...props, ...ele.props };
|
props = { ...ele.props, ...props };
|
||||||
}
|
}
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 使用 getOptionProps 替换 ,待测试
|
// 使用 getOptionProps 替换 ,待测试
|
||||||
const getPropsData = ele => {
|
const getPropsData = vnode => {
|
||||||
return getOptionProps(ele);
|
const res = {};
|
||||||
//return ele.props || {};
|
const originProps = vnode.props || {};
|
||||||
|
const props = {};
|
||||||
|
Object.keys(originProps).forEach(key => {
|
||||||
|
props[camelize(key)] = originProps[key];
|
||||||
|
});
|
||||||
|
const options = vnode.type.props;
|
||||||
|
Object.keys(options).forEach(k => {
|
||||||
|
const v = resolvePropValue(options, props, k, props[k]);
|
||||||
|
if (k in props) {
|
||||||
|
// 仅包含 props,不包含默认值
|
||||||
|
res[k] = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return res;
|
||||||
};
|
};
|
||||||
const getValueByProp = (ele, prop) => {
|
const getValueByProp = (ele, prop) => {
|
||||||
return getPropsData(ele)[prop];
|
return getPropsData(ele)[prop];
|
||||||
|
|
|
@ -3,15 +3,13 @@ import DropdownButton from './dropdown-button';
|
||||||
|
|
||||||
export { DropdownProps } from './dropdown';
|
export { DropdownProps } from './dropdown';
|
||||||
export { DropdownButtonProps } from './dropdown-button';
|
export { DropdownButtonProps } from './dropdown-button';
|
||||||
import Base from '../base';
|
|
||||||
|
|
||||||
Dropdown.Button = DropdownButton;
|
Dropdown.Button = DropdownButton;
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
Dropdown.install = function(Vue) {
|
Dropdown.install = function(app) {
|
||||||
Vue.use(Base);
|
app.component(Dropdown.name, Dropdown);
|
||||||
Vue.component(Dropdown.name, Dropdown);
|
app.component(DropdownButton.name, DropdownButton);
|
||||||
Vue.component(DropdownButton.name, DropdownButton);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Dropdown;
|
export default Dropdown;
|
||||||
|
|
|
@ -45,13 +45,14 @@ export default {
|
||||||
...tooltipProps,
|
...tooltipProps,
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
overlayClassName: `${rootPrefixCls}-inline-collapsed-tooltip`,
|
overlayClassName: `${rootPrefixCls}-inline-collapsed-tooltip`,
|
||||||
children: (
|
};
|
||||||
|
return (
|
||||||
|
<Tooltip {...toolTipProps}>
|
||||||
|
{/* */}
|
||||||
<Item {...itemProps} ref="menuItem">
|
<Item {...itemProps} ref="menuItem">
|
||||||
{getSlot(this)}
|
{getSlot(this)}
|
||||||
</Item>
|
</Item>
|
||||||
),
|
</Tooltip>
|
||||||
};
|
);
|
||||||
// return <div>ddd</div>;
|
|
||||||
return <Tooltip {...toolTipProps}></Tooltip>;
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-button @click="show = !show">按钮</a-button>
|
<demo />
|
||||||
<a-tooltip class="ddddd" style="color: blue" v-if="show">
|
|
||||||
<template v-slot:title>prompt text</template>
|
|
||||||
<a-button class="test" style="color: red">Tooltip will show when mouse enter.</a-button>
|
|
||||||
</a-tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import demo from '../antdv-demo/docs/menu/demo/horizontal';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
demo,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: true,
|
current: ['mail'],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,10 +32,20 @@ import Modal from 'ant-design-vue/modal';
|
||||||
import Menu from 'ant-design-vue/menu';
|
import Menu from 'ant-design-vue/menu';
|
||||||
import 'ant-design-vue/style.js';
|
import 'ant-design-vue/style.js';
|
||||||
|
|
||||||
|
const basic = {
|
||||||
|
render() {
|
||||||
|
return this.$slots.default && this.$slots.default();
|
||||||
|
},
|
||||||
|
};
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
app.config.globalProperties.$notification = notification;
|
app.config.globalProperties.$notification = notification;
|
||||||
app.config.globalProperties.$message = message;
|
app.config.globalProperties.$message = message;
|
||||||
app
|
app
|
||||||
|
.component('demo-sort', { ...basic })
|
||||||
|
.component('md', { ...basic })
|
||||||
|
.component('api', { ...basic })
|
||||||
|
.component('CN', { ...basic })
|
||||||
|
.component('US', { ...basic })
|
||||||
.use(Avatar)
|
.use(Avatar)
|
||||||
.use(Breadcrumb)
|
.use(Breadcrumb)
|
||||||
.use(Button)
|
.use(Button)
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = {
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /\.(vue|md)$/,
|
||||||
loader: 'vue-loader',
|
loader: 'vue-loader',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ module.exports = {
|
||||||
'ant-design-vue': path.join(__dirname, './components'),
|
'ant-design-vue': path.join(__dirname, './components'),
|
||||||
// vue$: 'vue/dist/vue.esm.js',
|
// vue$: 'vue/dist/vue.esm.js',
|
||||||
},
|
},
|
||||||
extensions: ['.js', '.jsx', '.vue'],
|
extensions: ['.js', '.jsx', '.vue', '.md'],
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
historyApiFallback: {
|
historyApiFallback: {
|
||||||
|
|
Loading…
Reference in New Issue