mirror of https://github.com/ElemeFE/element
support vue 2.2 (#3097)
parent
46fc121cb3
commit
ce8c869292
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
|
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
|
||||||
import scrollbarWidth from 'element-ui/src/utils/scrollbar-width';
|
import scrollbarWidth from 'element-ui/src/utils/scrollbar-width';
|
||||||
import * as util from './util';
|
import { toObject } from 'element-ui/src/utils/util';
|
||||||
import Bar from './bar';
|
import Bar from './bar';
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
|
@ -48,7 +48,7 @@ export default {
|
||||||
const gutterStyle = `margin-bottom: ${gutterWith}; margin-right: ${gutterWith};`;
|
const gutterStyle = `margin-bottom: ${gutterWith}; margin-right: ${gutterWith};`;
|
||||||
|
|
||||||
if (Array.isArray(this.wrapStyle)) {
|
if (Array.isArray(this.wrapStyle)) {
|
||||||
style = util.toObject(this.wrapStyle);
|
style = toObject(this.wrapStyle);
|
||||||
style.marginRight = style.marginBottom = gutterWith;
|
style.marginRight = style.marginBottom = gutterWith;
|
||||||
} else if (typeof this.wrapStyle === 'string') {
|
} else if (typeof this.wrapStyle === 'string') {
|
||||||
style += gutterStyle;
|
style += gutterStyle;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import Vue from 'vue';
|
|
||||||
|
|
||||||
export const BAR_MAP = {
|
export const BAR_MAP = {
|
||||||
vertical: {
|
vertical: {
|
||||||
offset: 'offsetHeight',
|
offset: 'offsetHeight',
|
||||||
|
@ -34,5 +32,3 @@ export function renderThumbStyle({ move, size, bar }) {
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toObject = Vue.util.toObject;
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
|
import { hasOwn } from 'element-ui/src/utils/util';
|
||||||
|
|
||||||
|
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
|
||||||
/**
|
/**
|
||||||
* String format template
|
* String format template
|
||||||
* - Inspired:
|
* - Inspired:
|
||||||
* https://github.com/Matt-Esch/string-template/index.js
|
* https://github.com/Matt-Esch/string-template/index.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
|
|
||||||
|
|
||||||
export default function(Vue) {
|
export default function(Vue) {
|
||||||
const { hasOwn } = Vue.util;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* template
|
* template
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
export function hasOwn(obj, key) {
|
||||||
|
return hasOwnProperty.call(obj, key);
|
||||||
|
};
|
||||||
|
|
||||||
|
function extend(to, _from) {
|
||||||
|
for (let key in _from) {
|
||||||
|
to[key] = _from[key];
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function toObject(arr) {
|
||||||
|
var res = {};
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
if (arr[i]) {
|
||||||
|
extend(res, arr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import Vue from 'vue';
|
import { hasOwn } from 'element-ui/src/utils/util';
|
||||||
|
|
||||||
export function isVNode(node) {
|
export function isVNode(node) {
|
||||||
return typeof node === 'object' && Vue.util.hasOwn(node, 'componentOptions');
|
return typeof node === 'object' && hasOwn(node, 'componentOptions');
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getFirstComponentChild(children) {
|
export function getFirstComponentChild(children) {
|
||||||
|
|
Loading…
Reference in New Issue