🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

zto-express-ui

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zto-express-ui

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

logo

zto-express-ui

基于vue2的移动端组件库

🚀文档网站

快速开始

# 通过 npm
npm i zto-express-ui
# 通过 yarn
yarn add zto-express-ui
# 通过 pnpm
pnpm add zto-express-ui

引入组件

1.自动按需引入组件(推荐)

babel-plugin-import 是一款 babel 插件,它会在编译过程中将 import 的写法自动转换为按需引入的方式。

# 安装插件
npm install babel-plugin-import -D
// 在.babelrc 中添加配置
// 注意:webpack 1 无需设置 libraryDirectory
{
  "plugins": [
    ["import", {
      "libraryName": "zto-express-ui",
      "libraryDirectory": "es",
      "style": true
    }]
  ]
}

// 对于使用 babel7 的用户,可以在 babel.config.js 中配置
module.exports = {
  plugins: [
    ['import', {
      libraryName: 'zto-express-ui',
      libraryDirectory: 'es',
      style: true
    }, 'zto-express-ui']
  ]
};
使用组件
<template>
  <div>
    <ze-button type="primary">按钮</ze-button>
  </div>
</template>

<script>
  import Vue from 'vue';
  import { Button } from 'zto-express-ui';
  Vue.use(Button);

  export default {
    data() {
      return {};
    }
  }
</script>

2.手动引入组件

<template>
  <div>
    <ze-button type="primary">按钮</ze-button>
  </div>
</template>

<script>
  import Vue from 'vue';
  import Button from 'zto-express-ui/lib/button';
  import 'zto-express-ui/lib/button/style';
  Vue.use(Button);

  export default {
    data() {
      return {};
    }
  }
</script>

3.导入所有组件

支持一次性导入所有组件,引入所有组件会增加代码包体积,因此不推荐这种做法。

// main.js
import Vue from 'vue';
import zeUi from 'zto-express-ui';
import 'zto-express-ui/lib/index.css';
Vue.use(zeUi);

FAQs

Package last updated on 11 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts