1. zarm-vue

zarm-vue

Zarm Vue

Build Status
Coverage Status
Netlify Status
npm package
NPM downloads
JS gzip size
CSS gzip size
License

版本

  • Beta版:npm package

Install 安装

 npm install zarm-vue --save

Import 引入

  • 全组件引入
 import Vue from 'vue';
import zarmVue from 'zarm-vue';
// 引入全局样式
import 'zarm-vue/zarm-vue.default.css';
Vue.use(zarmVue);
  • 按需引入

借助ElementUI提供的babel-plugin-component,我们可以只引入需要的组件,以达到减小项目体积的目的。

首先,安装 babel-plugin-component:

 npm install babel-plugin-component -D

然后,将 .babelrc 添加:

 {
  // ...
  "plugins": [["component", {
      "libraryName": "zarm-vue",
      "styleLibraryName": "theme"
    }
  ]]
}

接下来,如果你只希望引入部分组件,比如 Button 和 Alert,那么需要在 main.js 中写入以下内容:

 import { Button, Alert } from 'zarm-vue'
Vue.use(Button)
Vue.use(Alert)
  • 也可以通过cdn引入umd模块
 <!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/zarm-vue@latest/zarm-vue.default.css">
  <script src="https://unpkg.com/vue@latest/dist/vue.min.js"></script>
  <script src="https://unpkg.com/zarm-vue@latest/zarm-vue.umd.js"></script>
</head>
<body>
  <div id="app">
      <za-button theme="primary">普通按钮</za-button>
  </div>
</body>
<script>
  new Vue({
    el: '#app'
  })
</script>
</html>

Dependencies

@babel/cli: ^7.4.4@babel/core: ^7.4.5@babel/node: ^7.4.5@babel/plugin-syntax-dynamic-import: ^7.2.0@babel/plugin-transform-modules-commonjs: ^7.0.0@babel/plugin-transform-object-assign: ^7.2.0@babel/plugin-transform-runtime: ^7.4.4@babel/preset-env: ^7.4.5@babel/runtime: ^7.4.5@babel/runtime-corejs2: ^7.4.2@commitlint/cli: ^6.2.0@commitlint/config-conventional: ^6.1.3@vue/babel-preset-jsx: ^1.0.0@vue/server-test-utils: ^1.0.3@vue/test-utils: ^1.0.3autoprefixer: ^7.1.2axios: ^0.18.0babel-core: ^7.0.0-bridge.0babel-eslint: ^10.0.1babel-helper-vue-jsx-merge-props: ^2.0.3babel-jest: ^23.4.2babel-loader: ^8.0.5babel-plugin-dynamic-import-node: ^2.3.0babel-plugin-import: ^1.11.0babel-plugin-syntax-jsx: ^6.18.0babel-plugin-transform-vue-jsx: ^3.7.0chalk: ^2.4.2connect-history-api-fallback: ^1.3.0conventional-changelog-cli: ^1.3.22copy-webpack-plugin: ^4.0.1core-js: ^3.0.1coveralls: ^2.13.1cross-env: ^5.0.1cryptiles: ^4.1.2css-loader: ^0.28.0element-ui: ^2.4.9eslint: ^4.19.1eslint-config-za: ^1.0.0eslint-friendly-formatter: ^3.0.0eslint-import-resolver-webpack: ^0.8.1eslint-loader: ^2.0.0eslint-plugin-html: ^3.2.2eslint-plugin-import: ^2.2.0fetch: ^1.1.0file-loader: ^1.1.11friendly-errors-webpack-plugin: ^1.1.3gh-pages: ^2.0.1github-markdown-css: ^2.10.0glob: ^7.1.2handlebars: ^4.0.11html-webpack-plugin: ^3.2.0http-proxy-middleware: ^0.17.3husky: ^0.14.3jest: ^23.4.2jest-serializer-vue: ^2.0.2js-yaml: ^3.13.1lodash: ^4.17.15lodash-es: ^4.17.15lodash.merge: ^4.6.2lodash.mergewith: ^4.6.2marked: ^0.7.0merge: ^1.2.1mini-css-extract-plugin: ^0.4.0normalize.css: ^8.0.0opn: ^5.1.0optimize-css-assets-webpack-plugin: ^4.0.2postcss-loader: ^2.0.6rimraf: ^2.6.1sass: ^1.22.9sass-loader: ^7.0.1shelljs: ^0.7.6stylelint: ^7.12.0stylelint-config-standard: ^16.0.0tunnel-agent: ^0.6.0url-loader: ^1.0.1vue: ^2.6.10vue-jest: ^3.0.0vue-loader: ^15.0.7vue-router: ^2.6.0vue-style-loader: ^4.1.0vue-template-compiler: ^2.6.10vuex: ^3.0.1webpack: ^4.10.1webpack-bundle-analyzer: ^3.3.2webpack-cli: ^3.3.5webpack-dev-middleware: ^3.1.3webpack-dev-server: ^3.2.1webpack-hot-middleware: ^2.18.0webpack-merge: ^4.2.1zarm-vue-loader: ^3.0.0