Skip to content

Commit

Permalink
fix: Vue warn on install, close #1031
Browse files Browse the repository at this point in the history
  • Loading branch information
Javey committed Aug 15, 2024
1 parent 835a532 commit 4befca6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/kpc-vue-next/install.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as components from './index';
import { isFunction } from 'intact-shared';

export function install(Vue) {
for (let key in components) {
// exclude the non-component properties
// the name of component starts with an upper case char
// and the value is a function
const charCode = key.charCodeAt(0);
if (charCode < 'A'.charCodeAt(0) && charCode > 'Z'.charCodeAt(0)) continue;
if (charCode < 'A'.charCodeAt(0) || charCode > 'Z'.charCodeAt(0)) continue;

const component = components[key];
if (!isFunction(component)) continue;

Vue.component(`K${key}`, component);
// support call method like this.$message.success('test'), #88
const obj = Vue.config.globalProperties;
Expand Down
7 changes: 6 additions & 1 deletion packages/kpc-vue/install.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as components from './index';
import { isFunction } from 'intact-shared';

export function install(Vue) {
for (let key in components) {
// exclude the non-component properties
// the name of component starts with an upper case char
// and the value is a function
const charCode = key.charCodeAt(0);
if (charCode < 'A'.charCodeAt(0) && charCode > 'Z'.charCodeAt(0)) continue;
if (charCode < 'A'.charCodeAt(0) || charCode > 'Z'.charCodeAt(0)) continue;

const component = components[key];
if (!isFunction(component)) continue;

Vue.component(`K${key}`, component);
// support call method like this.$message.success('test'), #88
const obj = Vue.prototype;
Expand Down

0 comments on commit 4befca6

Please sign in to comment.