[Improvement] Support Vue.use to register a component (#401)

This commit is contained in:
neverland
2017-12-11 20:41:19 +08:00
committed by GitHub
parent 7dbb5db256
commit 6f2b4c99da
162 changed files with 432 additions and 490 deletions
+15 -5
View File
@@ -1,12 +1,13 @@
import Vue from 'vue';
import create from './create';
export const isServer = Vue.prototype.$isServer;
const isServer = Vue.prototype.$isServer;
export function isDef(value) {
function isDef(value) {
return value !== undefined && value !== null;
}
export function get(object, path) {
function get(object, path) {
const keys = path.split('.');
let result = object;
@@ -18,11 +19,20 @@ export function get(object, path) {
}
const camelizeRE = /-(\w)/g;
export function camelize(str) {
function camelize(str) {
return str.replace(camelizeRE, (_, c) => c.toUpperCase());
}
export function isAndroid() {
function isAndroid() {
/* istanbul ignore next */
return isServer ? false : /android/.test(navigator.userAgent.toLowerCase());
}
export {
get,
isDef,
create,
isServer,
camelize,
isAndroid
};