# 全量引入
# 安装
# npm 安装
npm i -S dolphin-intl-ui 或者 npm install dolphin-intl-ui --save
1
2
2
# yarn 安装
yarn add dolphin-intl-ui
1
2
3
2
3
# 升级组件库
- 使用 npm install -S + 模块
name+ 版本号。
# 升级到最新版本
npm install -S dolphin-intl-ui@latest
# 升级到指定版本,例如:
npm install -S dolphin-intl-ui@ + 版本号
# 使用0.0.30版本:
npm install -S dolphin-intl-ui@0.0.30
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
- 手动修改
package.json文件下的模块的版本号,然后执行以下命令:
npm install
1
2
2
# Hello World
<template>
<div class="app">
<text>{{title}}</text>
<dof-button text="快速上手"></dof-button>
</div>
</template>
<script>
import { DofButton } from 'dolphin-intl-ui'
export default {
components: {
DofButton
},
data:() => ({
title: 'hello world'
})
}
</script>
<style scoped>
.app {
width: 750px;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 构建配置
在项目构建配置中,需要确保 excludeModuleReg 包含 dolphin-intl-ui,以便组件库能被正确编译:
// configs/config.js
module.exports = {
// ...
// 排除 node_modules 中不需要编译的模块,dolphin-intl-ui 需要包含在编译范围内
excludeModuleReg: /node_modules(?!(\/|\\).*dolphin-intl-ui.*)/,
// ...
}
1
2
3
4
5
6
7
2
3
4
5
6
7
说明
excludeModuleReg 用于配置哪些模块不需要参与编译。默认情况下 node_modules 中的模块会被排除,但 dolphin-intl-ui 组件库需要被包含在编译范围内,因此需要在正则中将其排除在外。
# 参数说明
参数表中的 Required / 是否必须表示参数是否必填;不同模式或参数组合的使用要求见各组件说明。默认值为 undefined 表示未设置默认值;随主题或其他参数变化的默认值见对应组件的说明。