perf: update to vue 2.6.x
parent
629d4c44d2
commit
4df4424570
|
@ -60,6 +60,13 @@ const getSlots = ele => {
|
|||
});
|
||||
return slots;
|
||||
};
|
||||
const getSlot = (self, name = 'default', options = {}) => {
|
||||
return (
|
||||
(self.$scopedSlots && self.$scopedSlots[name] && self.$scopedSlots[name](options)) ||
|
||||
self.$slots[name] ||
|
||||
[]
|
||||
);
|
||||
};
|
||||
const getAllChildren = ele => {
|
||||
let componentOptions = ele.componentOptions || {};
|
||||
if (ele.$vnode) {
|
||||
|
@ -105,9 +112,9 @@ const getComponentFromProp = (instance, prop, options = instance, execute = true
|
|||
return typeof temp === 'function' && execute ? temp(h, options) : temp;
|
||||
}
|
||||
return (
|
||||
instance.$slots[prop] ||
|
||||
(instance.$scopedSlots[prop] && execute && instance.$scopedSlots[prop](options)) ||
|
||||
instance.$scopedSlots[prop] ||
|
||||
instance.$slots[prop] ||
|
||||
undefined
|
||||
);
|
||||
} else {
|
||||
|
@ -289,6 +296,7 @@ export {
|
|||
isValidElement,
|
||||
camelize,
|
||||
getSlots,
|
||||
getSlot,
|
||||
getAllProps,
|
||||
getAllChildren,
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import addEventListener from '../_util/Dom/addEventListener';
|
|||
import { isWindow, buffer, isSamePoint } from './util';
|
||||
import { cloneElement } from '../_util/vnode.js';
|
||||
import clonedeep from 'lodash/cloneDeep';
|
||||
import { getSlot } from '../_util/props-util';
|
||||
|
||||
function getElement(func) {
|
||||
if (typeof func !== 'function' || !func) return null;
|
||||
|
@ -133,8 +134,8 @@ export default {
|
|||
|
||||
render() {
|
||||
const { childrenProps } = this.$props;
|
||||
const child = this.$slots.default[0];
|
||||
if (childrenProps) {
|
||||
const child = getSlot(this)[0];
|
||||
if (child && childrenProps) {
|
||||
return cloneElement(child, { props: childrenProps });
|
||||
}
|
||||
return child;
|
||||
|
|
12
package.json
12
package.json
|
@ -56,8 +56,8 @@
|
|||
"prettier"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"vue": ">=2.5.0",
|
||||
"vue-template-compiler": ">=2.5.0"
|
||||
"vue": ">=2.6.6",
|
||||
"vue-template-compiler": ">=2.6.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^6.2.0",
|
||||
|
@ -153,17 +153,17 @@
|
|||
"through2": "^2.0.3",
|
||||
"uglifyjs-webpack-plugin": "^2.1.1",
|
||||
"url-loader": "^1.1.2",
|
||||
"vue": "^2.5.16",
|
||||
"vue": "^2.6.6",
|
||||
"vue-antd-md-loader": "^1.1.0",
|
||||
"vue-clipboard2": "0.0.8",
|
||||
"vue-eslint-parser": "^5.0.0",
|
||||
"vue-i18n": "^8.3.2",
|
||||
"vue-infinite-scroll": "^2.0.2",
|
||||
"vue-jest": "^2.5.0",
|
||||
"vue-loader": "^15.5.1",
|
||||
"vue-loader": "^15.6.2",
|
||||
"vue-router": "^3.0.1",
|
||||
"vue-server-renderer": "^2.5.16",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"vue-server-renderer": "^2.6.6",
|
||||
"vue-template-compiler": "^2.6.6",
|
||||
"vue-virtual-scroller": "^0.12.0",
|
||||
"vuex": "^3.1.0",
|
||||
"webpack": "^4.28.4",
|
||||
|
|
Loading…
Reference in New Issue