2022-04-20 Work record--Use of Vue-vue2-vant component library

vue2- vantUse of component library

Official website: http://vant-contrib.gitee.io/vant/v2/#/zh-CN/home

The first step, install the vant 2.xversion

In the official website, click "Quick Start" on the left , there is a detailed installation introduction, for npmexample, as shown below:insert image description here

npmvant 2.xThe corresponding code for the installed version:npm i vant@latest-v2 -S

The second step, import components

On the official website, click "Quick Start" on the left , scroll down, and find "Introduce Components" . There are detailed introduction methods, as shown in the figure below: [There are three methods, the first one is recommended, follow the steps in the documentation Can】insert image description here

Example: (Method 1. Automatically import components on demand (recommended))

  • The first step, install the plugin:npm i babel-plugin-import -D
  • The second step, babel.config.jsadd the configuration in:insert image description here

The third step, Vantthe method of using the component [important

On the official website, click "Advanced Usage" on the left , scroll down, find "Partial Registration" , there is a detailed introduction to the usage, as shown below:
insert image description here

Example: Use vantthe tab page in the component library, as shown below:
insert image description here
The result is as follows:
insert image description here

おすすめ

転載: blog.csdn.net/weixin_48850734/article/details/124298388