2.1.4 • Published 2 years ago

yv-vue-components v2.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

yv-vue-components组件库

平常在vue项目中用到的时候,写的一些组件

npm安装

npm install yv-vue-components

全局引用

import YvVueComponents from 'yv-vue-components'
Vue.use(YvVueComponents)

按需引用

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

首先,安装 babel-plugin-component:

npm install babel-plugin-component -D

然后,将 .babelrc 修改为:

{
  "presets": [["es2015", { "modules": false }]],
  "plugins": [
    [
      "component",
      {
        "libraryName": "yv-vue-components",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ]
}

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

import Vue from 'vue';
import { ScrollTabs } from 'yv-vue-components';
import App from './App.vue';

Vue.component(ScrollTabs.name, ScrollTabs);
/* 或写为
 * Vue.use(ScrollTabs)
 */

new Vue({
  el: '#app',
  render: h => h(App)
});

示例

<!-- 下载项目 -->
npm install
<!-- 启动项目查看示例 -->
npm run dev
2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago