Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 37bfea3

Browse files
feat: add vant ui framework (#710)
1 parent 43da555 commit 37bfea3

File tree

7 files changed

+104
-0
lines changed

7 files changed

+104
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ yarn create nuxt-app <my-project>
4848
- [View UI](https://www.iviewui.com/)
4949
- [Tachyons](https://github.com/tachyons-css/tachyons)
5050
- [Tailwind CSS](https://github.com/tailwindcss/tailwindcss)
51+
- [Vant](https://github.com/youzan/vant)
5152
- [Vuesax](https://github.com/lusaxweb/vuesax)
5253
- [Vuetify](https://github.com/vuetifyjs/vuetify)
5354
1. Nuxt.js modules:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"vant": "^2.12.6"
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Vue from 'vue'
2+
import Vant from 'vant'
3+
4+
Vue.use(Vant)

packages/cna-template/template/nuxt/nuxt.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
'framevuerk/dist/framevuerk-nuxt.min.css'
5555
<%_ } else if (ui === 'vuesax') { _%>
5656
'vuesax/dist/vuesax.css'
57+
<%_ } else if (ui === 'vant') { _%>
58+
'vant/lib/index.css'
5759
<%_ } _%>
5860
],
5961

@@ -71,6 +73,8 @@
7173
'@/plugins/framevuerk'
7274
<%_ } else if (ui === 'vuesax') { _%>
7375
'@/plugins/vuesax'
76+
<%_ } else if (ui === 'vant') { _%>
77+
'@/plugins/vant'
7478
<%_ } _%>
7579
],
7680

packages/create-nuxt-app/lib/prompts.js

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = [
4141
{ name: 'View UI', value: 'view-ui' },
4242
{ name: 'Tachyons', value: 'tachyons' },
4343
{ name: 'Tailwind CSS', value: 'tailwind' },
44+
{ name: 'Vant', value: 'vant' },
4445
{ name: 'Vuesax', value: 'vuesax' },
4546
{ name: 'Vuetify.js', value: 'vuetify' },
4647
{ name: 'Oruga', value: 'oruga' }

packages/create-nuxt-app/test/snapshots/index.test.js.md

+89
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,95 @@ Generated by [AVA](https://avajs.dev).
14251425
}␊
14261426
`
14271427

1428+
## verify ui: Vant
1429+
1430+
> Generated files
1431+
1432+
[
1433+
'.editorconfig',
1434+
'.gitignore',
1435+
'README.md',
1436+
'assets/README.md',
1437+
'components/Logo.vue',
1438+
'components/README.md',
1439+
'layouts/README.md',
1440+
'layouts/default.vue',
1441+
'middleware/README.md',
1442+
'nuxt.config.js',
1443+
'package.json',
1444+
'pages/README.md',
1445+
'pages/index.vue',
1446+
'plugins/README.md',
1447+
'plugins/vant.js',
1448+
'static/README.md',
1449+
'static/favicon.ico',
1450+
'store/README.md',
1451+
]
1452+
1453+
> package.json
1454+
1455+
{
1456+
dependencies: {
1457+
'core-js': '^3.8.3',
1458+
nuxt: '^2.14.12',
1459+
vant: '^2.12.6',
1460+
},
1461+
devDependencies: {},
1462+
private: true,
1463+
scripts: {
1464+
build: 'nuxt build',
1465+
dev: 'nuxt',
1466+
generate: 'nuxt generate',
1467+
start: 'nuxt start',
1468+
},
1469+
}
1470+
1471+
> Generated nuxt.config.js
1472+
1473+
`export default {␊
1474+
// Global page headers: https://go.nuxtjs.dev/config-head␊
1475+
head: {␊
1476+
title: 'output',␊
1477+
htmlAttrs: {␊
1478+
lang: 'en'␊
1479+
},␊
1480+
meta: [␊
1481+
{ charset: 'utf-8' },␊
1482+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },␊
1483+
{ hid: 'description', name: 'description', content: '' }␊
1484+
],␊
1485+
link: [␊
1486+
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊
1487+
]␊
1488+
},␊
1489+
1490+
// Global CSS: https://go.nuxtjs.dev/config-css␊
1491+
css: [␊
1492+
'vant/lib/index.css'␊
1493+
],␊
1494+
1495+
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins␊
1496+
plugins: [␊
1497+
'@/plugins/vant'␊
1498+
],␊
1499+
1500+
// Auto import components: https://go.nuxtjs.dev/config-components␊
1501+
components: true,␊
1502+
1503+
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules␊
1504+
buildModules: [␊
1505+
],␊
1506+
1507+
// Modules: https://go.nuxtjs.dev/config-modules␊
1508+
modules: [␊
1509+
],␊
1510+
1511+
// Build Configuration: https://go.nuxtjs.dev/config-build␊
1512+
build: {␊
1513+
}␊
1514+
}␊
1515+
`
1516+
14281517
## verify ui: Vuesax
14291518

14301519
> Generated files
Binary file not shown.

0 commit comments

Comments
 (0)