mirror of
https://github.com/youzan/vant.git
synced 2025-12-20 01:01:34 +08:00
[Improvement] Support Vue.use to register a component (#401)
This commit is contained in:
19
packages/utils/create.js
Normal file
19
packages/utils/create.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Create a component with common options
|
||||
*/
|
||||
import '../locale';
|
||||
import Icon from '../icon';
|
||||
import i18n from '../mixins/i18n';
|
||||
import install from './install';
|
||||
import Loading from '../loading';
|
||||
|
||||
export default function(sfc) {
|
||||
sfc.mixins = sfc.mixins || [];
|
||||
sfc.components = sfc.components || {};
|
||||
sfc.install = sfc.install || install;
|
||||
sfc.mixins.push(i18n);
|
||||
sfc.components.icon = Icon;
|
||||
sfc.components.loading = Loading;
|
||||
|
||||
return sfc;
|
||||
};
|
||||
Reference in New Issue
Block a user