It’s time to start a Vue component library of your own!!!



Based on Vue (2. X) a set of background UI framework, UI design is based on the UI design of element and iView

At present, there are all kinds of excellent Vue component libraries in the market. Have you ever thought about how to realize the bottom layer? For a mature component library, it is extremely painful to look at the source code of the component library because it has been iterated many times,Doran UI has few iterations, and comments are added to the source code where it is difficult to understand. The source code is simple and easy to read. It is a good thing for learning progress and understanding the underlying knowledge, which is worth reading and learning
githubAddress, welcome to start, in addition, do not understand or find bugs, you can mentionissuesI’ll get back in time if I see it

Note: because it has not been tested and promoted, the UI is only for learning.

The views directory is the demo of each component

git clone
cd Doran
npm i
npm run serve


Global introduction

Generally in the webpack entry page main.js The configuration is as follows:

import  Vue  from  'vue'
import  DoranUi  from  'doran'
import  'doran/dist/ doran.css '// introduce CSS
import  App  from  './App.vue'


new  Vue({
    render: h  =>  h(App),

On demand introduction

With plug-insbabel-plugin-importIt can load components on demand and reduce the volume of files. First, install and configure in the project root file. Babelrc

NPM install Babel plugin import -- save dev // install

In. Babelrc file

    "plugins": [["import", {
        "libraryName": "doran",
        "libraryDirectory": "dist/components"

Then, by introducing components as needed, the volume can be reduced

    <div  id="app">
        <dr-button  type="error">Doran</dr-button>
        < Dr input placeholder = "please input" > < / DR input >
import { Button, Input } from  'doran'
export  default {
    name: 'App',
    components: {
        DrButton: Button,
        DrInput: Input

Note: you still need to import styles for on-demand references main.js Global introduction in



Completed components

This work adoptsCC agreementReprint must indicate the author and the link of this article