# 安装

# npm 安装

npm i -S dolphin-intl-ui  或者 npm install dolphin-intl-ui --save

1
2

# yarn 安装


yarn add dolphin-intl-ui

1
2
3

# 升级组件库

  • 使用 cnpm install -S + 模块name + 版本号,推荐使用cnpm,此处使用npm在部分版本下有问题。
# 升级到最新版本

    cnpm install -S dolphin-intl-ui@latest 

# 升级到指定版本,例如: 

    cnpm install -S dolphin-intl-ui@ + 版本号

# 使用0.0.30版本:

    cnpm install -S dolphin-intl-ui@0.0.30

1
2
3
4
5
6
7
8
9
10
11
12
  • 手动修改package.json文件下的模块的版本号,然后执行以下命令:
cnpm install(推荐)
#或者
npm update 
#或者
npm install

1
2
3
4
5
6

# hello World

<template>
    <div class="app">
        <text>{{title}}</text>
        <dof-button title="快速上手"></dof-button>
    </div>
</template>
<script>
import { DofButton } from 'dolphin-wee-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

# 构建配置

在项目构建配置中,需要确保 excludeModuleReg 包含 dolphin-intl-ui,以便组件库能被正确编译:

// configs/config.js
module.exports = {
    // ...
    // 排除 node_modules 中不需要编译的模块,dolphin-intl-ui 需要包含在编译范围内
    excludeModuleReg: /node_modules(?!(\/|\\).*(weex|dolphin-intl-ui).*)/,
    // ...
}
1
2
3
4
5
6
7

说明

excludeModuleReg 用于配置哪些模块不需要参与编译。默认情况下 node_modules 中的模块会被排除,但 dolphin-intl-ui 组件库需要被包含在编译范围内,因此需要在正则中将其排除在外。

注:

如果 npm 安装较慢,可以切换到淘宝源,使用cnpm安装

切换到淘宝镜像:npm config set registry https://registry.npm.taobao.org