1.0.2 • Published 1 year ago

@wy908/wk-navbar v1.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Install

npm install @wy908/wk-navbar --save-dev

Usage

在测试项目里的babel.config.js,添加babel-plugin-component配置,并重启项目。

// babel.config.js
module.exports = {
  presets: ["@vue/cli-plugin-babel/preset"],
  plugins: [
    [
      'component',
      {
        libraryName: 'element-ui',
        styleLibraryName: 'theme-chalk'
      },
      'element-ui'
    ],
    [
      'component',
      {
        libraryName: 'test-lib',
        styleLibrary: {
          "name": "lib-style", // same with styleLibraryName
          "base": false  // if theme package has a base.css
        }
      },
      'test-lib'
    ],
  ]
};

在test.vue中使用组件库

<template>
<div>
  <navbar :text="msg"></navbar>
  <el-button type="primary" class="dg-margin-t-20">element-button</el-button>
</div>
</template>
<script>
import Vue from "vue";
import { navbar } from "juejintest-lib";
import { button } from "element-ui";
Vue.use(navbar)
Vue.use(button)
export default {
  data:function() {
      return {
          msg: 'text'
      }
  }
};
</script>
<style lang="scss">
.dg-margin-t-20{
    margin-top:20px;
}
</style>