开发指南
# 安装
# 查看npm的源是不是私服:http://192.168.1.100:8081/repository/npm-all
npm config get registry
# 如果不是,修改npm源为私服地址
npm config set registry http://192.168.1.100:8081/repository/npm-all
# 安装
npx yarn add yb-components -S
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 使用
安装组件
import Vue from 'vue';
// 安装全部组件,这样会全量引入整个组件库
import YbComponents from 'yb-components';
Vue.use(YbComponents);
// 自行注册组件,这样会全量引入整个组件库
import { YbBallLoading } from 'yb-components';
Vue.component(YbBallLoading.name, YbBallLoading);
// 按需注册组件
import YbBallLoading from 'yb-components/packages/es/components/yb-ball-loading.js';
Vue.component(YbBallLoading.name, YbBallLoading);
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
当全局注册组件后,在 template 中使用 "-" 连接的名称,例如 YbBallLoading
对应 yb-ball-loading
通过yb-cli创建的 "web 项目开发" ,默认依赖了 yb-components ,并做了插件来自动生成 "src/demanded/index.js" 按需导入并全局注册 vue 组件(包括 element-ui),只需在.vue 直接使用对应组件
<template>
<div>
<yb-ball-loading :loading="true">
<el-button type="primary">测试</el-button>
</yb-ball-loading>
</div>
</template>
1
2
3
4
5
6
7
2
3
4
5
6
7
上次更新: 2022/05/22, 22:22:27