Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
component-lib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
component-lib
Commits
44edffbe
Commit
44edffbe
authored
Nov 03, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update readme
parent
becf1302
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
README.md
README.md
+12
-5
No files found.
README.md
View file @
44edffbe
...
@@ -2,25 +2,32 @@
...
@@ -2,25 +2,32 @@
## Dev
## Dev
1.
执行命令
`npm install`
安装依赖
1.
执行命令
`npm install`
安装依赖
2.
执行命令
`npm run serve`
启动本地服务进行开发
2.
执行命令
`npm start`
或
`npm run serve`
启动本地服务进行开发
## Build
## Build
1.
执行命令
`npm run build:unpkg`
进行打包;
1.
执行命令
`npm run build:web`
进行打包;
2.
将打包后的文件
`/dist/component-lib.min.js`
放置在服务器上;
2.
将打包后的文件
`/dist/component-lib.min.js`
放置在服务器上;
3.
在大屏项目中引入使用:
3.
在大屏项目中引入使用:
```
javascript
```
javascript
import
*
as
vue
from
'vue'
import
*
as
vue
from
'vue'
import
axios
from
'axios'
import
qs
from
'qs'
import
fetchComponents
from
'http://127.0.0.1:8080/component-lib.min.js'
// 假设打包文件放在http://127.0.0.1:8080上
import
fetchComponents
from
'http://127.0.0.1:8080/component-lib.min.js'
// 假设打包文件放在http://127.0.0.1:8080上
// 需要和大屏共用一个vue,因此将vue作为参数传入
// 需要和大屏共用一个vue,因此将vue作为参数传入
// 包中没有打进axios和qs,需要从主项目获得
// 第二个参数为请求数据地址
// 第二个参数为请求数据地址
const
{
components
,
eventBus
}
=
fetchComponents
(
vue
)(
'http://127.0.0.1:8082'
)
const
{
components
,
eventBus
}
=
fetchComponents
(
vue
,
axios
,
qs
,
)(
'http://127.0.0.1:8082'
)
export
default
components
// 暴露出组件
export
default
components
// 暴露出组件
export
const
bus
=
eventBus
// 暴露出组件的事件总线
export
const
bus
=
eventBus
// 暴露出组件的事件总线
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment