This commit is contained in:
Minho
2017-04-19 18:19:27 +08:00
parent fedf66bc0e
commit 4ebc28a431
308 changed files with 168450 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
"use strict";
exports.__esModule = true;
function _broadcast(componentName, eventName, params) {
this.$children.forEach(function (child) {
var name = child.$options.componentName;
if (name === componentName) {
child.$emit.apply(child, [eventName].concat(params));
} else {
_broadcast.apply(child, [componentName, eventName].concat([params]));
}
});
}
exports.default = {
methods: {
dispatch: function dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root;
var name = parent.$options.componentName;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
if (parent) {
name = parent.$options.componentName;
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
},
broadcast: function broadcast(componentName, eventName, params) {
_broadcast.call(this, componentName, eventName, params);
}
}
};

View File

@@ -0,0 +1,17 @@
'use strict';
exports.__esModule = true;
var _locale = require('element-ui/lib/locale');
exports.default = {
methods: {
t: function t() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _locale.t.apply(this, args);
}
}
};

View File

@@ -0,0 +1,62 @@
'use strict';
exports.__esModule = true;
/**
* Show migrating guide in browser console.
*
* Usage:
* import Migrating from 'element-ui/src/mixins/migrating';
*
* mixins: [Migrating]
*
* add getMigratingConfig method for your component.
* getMigratingConfig() {
* return {
* props: {
* 'allow-no-selection': 'allow-no-selection is removed.',
* 'selection-mode': 'selection-mode is removed.'
* },
* events: {
* selectionchange: 'selectionchange is renamed to selection-change.'
* }
* };
* },
*/
exports.default = {
mounted: function mounted() {
if (process.env.NODE_ENV === 'production') return;
if (!this.$vnode) return;
var _getMigratingConfig = this.getMigratingConfig(),
props = _getMigratingConfig.props,
events = _getMigratingConfig.events;
var _$vnode = this.$vnode,
data = _$vnode.data,
componentOptions = _$vnode.componentOptions;
var definedProps = data.attrs || {};
var definedEvents = componentOptions.listeners || {};
for (var propName in definedProps) {
if (definedProps.hasOwnProperty(propName) && props[propName]) {
console.warn('[Element Migrating][Attribute]: ' + props[propName]);
}
}
for (var eventName in definedEvents) {
if (definedEvents.hasOwnProperty(eventName) && events[eventName]) {
console.warn('[Element Migrating][Event]: ' + events[eventName]);
}
}
},
methods: {
getMigratingConfig: function getMigratingConfig() {
return {
props: {},
events: {}
};
}
}
};