Uniapp can use vant, because vant ui has h5 version and WeChat applet version, and starting from "uni-app2.4.7", H5 and QQ applet also support WeChat applet components. The method of use is to introduce the required components in "globalStyle" of "pages.json".
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.
Recommended (free): uni-app tutorial
uni-app uses Vant components
Preface
vant ui has h5 version and WeChat applet version. Its h5 version can only be used for h5, and its WeChat mini program version (vant weapp) can be used for WeChat and App. Starting from uni-app 2.4.7, H5 and QQ mini programs also support WeChat mini program components.
Use steps
Download code
Create a new
wxcomponents
directory in the project root directory. This directory should be the same ascomponents
directory sibling.Download the
vant-weapp
latest source code directly throughgit
and copy thedist
directory to the newly createdwxcomponents
directory, and renamedist
tovant-weapp
.-
Introduce the required components into globalStyle of pages.json
Try whether it is successful
<template> <p> <van-picker></van-picker> <van-button>显示</van-button> </p> </template> <script> export default { data() { return { columns: ["杭州", "宁波", "温州", "嘉兴", "湖州"], flag: false }; }, methods: { show() { console.log("1 =", "show"); this.flag = !this.flag; }, changePicker(event) { console.log("1 =", event); } } }; </script>
Notes
The message prompt in the Vant componentNotify
is quite special
Not only It needs to be introduced in globalStyle of pages.json and added to the vue prototype in main.js
//main.js import Notify from './wxcomponents//vant/notify/notify'; Vue.prototype.$notify = Notify
and then used
<template> <view> <van-button>弹出提示</van-button> <van-notify></van-notify> </view> </template> <script> export default { methods: { showNotify() { this.$notify({ type: "danger", message: "通知内容" }); } } }; </script>in the page
The above is the detailed content of Can uniapp use vant?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
