mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Build] revert site to webpack config (#3747)
This commit is contained in:
parent
6c0f05d5cc
commit
75525ae410
@ -12,8 +12,8 @@ const tasks = [
|
|||||||
'node build/build-components.js --color',
|
'node build/build-components.js --color',
|
||||||
'node build/build-style.js',
|
'node build/build-style.js',
|
||||||
'node build/build-style-entry.js',
|
'node build/build-style-entry.js',
|
||||||
'cross-env NODE_ENV=production webpack --color --config build/webpack.config.js',
|
'cross-env NODE_ENV=production webpack --color --config build/webpack.build.js',
|
||||||
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.config.js'
|
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.build.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
tasks.forEach(task => {
|
tasks.forEach(task => {
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const config = require('./webpack.dev.js');
|
||||||
|
|
||||||
const isMinify = process.argv.indexOf('-p') !== -1;
|
const isMinify = process.argv.indexOf('-p') !== -1;
|
||||||
|
|
||||||
module.exports = {
|
delete config.serve;
|
||||||
|
|
||||||
|
module.exports = Object.assign(config, {
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
entry: {
|
entry: {
|
||||||
vant: './es/index.js'
|
vant: './es/index.js'
|
||||||
@ -23,19 +26,8 @@ module.exports = {
|
|||||||
amd: 'vue'
|
amd: 'vue'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
performance: false,
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: isMinify
|
minimize: isMinify
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.ts', '.tsx']
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(js|ts|tsx)$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: 'babel-loader'
|
|
||||||
}
|
}
|
||||||
]
|
});
|
||||||
}
|
|
||||||
};
|
|
87
build/webpack.dev.js
Normal file
87
build/webpack.dev.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||||
|
const { VueLoaderPlugin } = require('vue-loader');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: 'development',
|
||||||
|
entry: {
|
||||||
|
'vant-docs': './docs/site/desktop/main.js',
|
||||||
|
'vant-mobile': './docs/site/mobile/main.js'
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '../docs/dist'),
|
||||||
|
publicPath: '/',
|
||||||
|
chunkFilename: 'async_[name].js'
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
modules: false,
|
||||||
|
children: false
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
open: true,
|
||||||
|
host: '0.0.0.0',
|
||||||
|
stats: 'errors-only',
|
||||||
|
clientLogLevel: 'warning'
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.ts', '.tsx', '.vue', '.less']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
preserveWhitespace: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(js|ts|tsx)$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: 'babel-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.less$/,
|
||||||
|
sideEffects: true,
|
||||||
|
use: [
|
||||||
|
'style-loader',
|
||||||
|
'css-loader',
|
||||||
|
'postcss-loader',
|
||||||
|
{
|
||||||
|
loader: 'less-loader',
|
||||||
|
options: {
|
||||||
|
paths: [path.resolve(__dirname, 'node_modules')]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.md$/,
|
||||||
|
use: ['vue-loader', '@vant/markdown-loader']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new ProgressBarPlugin(),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
chunks: ['vant-docs'],
|
||||||
|
template: 'docs/site/desktop/index.html',
|
||||||
|
filename: 'index.html',
|
||||||
|
inject: true
|
||||||
|
}),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
chunks: ['vant-mobile'],
|
||||||
|
template: 'docs/site/mobile/index.html',
|
||||||
|
filename: 'mobile.html',
|
||||||
|
inject: true
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
12
build/webpack.doc.js
Normal file
12
build/webpack.doc.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const config = require('./webpack.dev.js');
|
||||||
|
|
||||||
|
module.exports = Object.assign(config, {
|
||||||
|
mode: 'production',
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '../docs/dist'),
|
||||||
|
publicPath: 'https://youzan.github.io/vant/',
|
||||||
|
filename: '[name].[hash:8].js',
|
||||||
|
chunkFilename: 'async_[name].[chunkhash:8].js'
|
||||||
|
}
|
||||||
|
});
|
166
docs/site/desktop/App.vue
Normal file
166
docs/site/desktop/App.vue
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app">
|
||||||
|
<van-doc
|
||||||
|
:base="base"
|
||||||
|
:config="config"
|
||||||
|
:lang="$vantLang"
|
||||||
|
:github="github"
|
||||||
|
:versions="versions"
|
||||||
|
:simulators="simulators"
|
||||||
|
:search-config="searchConfig"
|
||||||
|
:current-simulator="currentSimulator"
|
||||||
|
@switch-version="onSwitchVersion"
|
||||||
|
>
|
||||||
|
<router-view @changeDemoURL="onChangeDemoURL" />
|
||||||
|
</van-doc>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import pkgJson from '../../../package.json';
|
||||||
|
import docConfig, { github, versions, searchConfig } from '../doc.config';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
this.github = github;
|
||||||
|
this.versions = versions;
|
||||||
|
this.searchConfig = searchConfig;
|
||||||
|
|
||||||
|
return {
|
||||||
|
simulators: [`mobile.html${location.hash}`],
|
||||||
|
demoURL: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
base() {
|
||||||
|
return `/${this.$vantLang}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
config() {
|
||||||
|
return docConfig[this.$vantLang];
|
||||||
|
},
|
||||||
|
|
||||||
|
currentSimulator() {
|
||||||
|
const { name } = this.$route;
|
||||||
|
return name && name.indexOf('demo') !== -1 ? 1 : 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.showVersionTip();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
showVersionTip() {
|
||||||
|
const tip = window.localStorage.getItem('vantVersionTip');
|
||||||
|
|
||||||
|
if (!tip && this.$vantLang === 'zh-CN') {
|
||||||
|
const version = document.querySelector('.van-doc-header__version');
|
||||||
|
version.insertAdjacentHTML('beforeend', `
|
||||||
|
<div class="doc-version-tip">
|
||||||
|
提示:你当前访问的是 Vant 2.0 版本文档,点此切换至旧版文档
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<button class="doc-version-tip__button">好哒</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
|
||||||
|
const tip = document.querySelector('.doc-version-tip');
|
||||||
|
const removeTip = event => {
|
||||||
|
event.stopPropagation();
|
||||||
|
tip.parentNode.removeChild(tip);
|
||||||
|
};
|
||||||
|
|
||||||
|
tip.addEventListener('click', removeTip);
|
||||||
|
version.addEventListener('click', removeTip);
|
||||||
|
|
||||||
|
window.localStorage.setItem('vantVersionTip', 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onChangeDemoURL(url) {
|
||||||
|
this.simulators = [this.simulators[0], url];
|
||||||
|
},
|
||||||
|
|
||||||
|
onSwitchVersion(version) {
|
||||||
|
if (version !== pkgJson.version) {
|
||||||
|
location.href = `https://youzan.github.io/vant/${version}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.van-doc-intro {
|
||||||
|
padding-top: 20px;
|
||||||
|
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-version-tip {
|
||||||
|
position: absolute;
|
||||||
|
top: 35px;
|
||||||
|
left: 50%;
|
||||||
|
z-index: 100;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 300px;
|
||||||
|
margin-left: -150px;
|
||||||
|
padding: 15px;
|
||||||
|
color: #333;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: 0 4px 12px #ebedf0;
|
||||||
|
transform-origin: top;
|
||||||
|
cursor: default;
|
||||||
|
animation: version-tip .25s cubic-bezier(0.175, 0.885, 0.32, 1.375);
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
position: absolute;
|
||||||
|
top: -4px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -3px;
|
||||||
|
border: 6px solid;
|
||||||
|
border-color: transparent transparent white white;
|
||||||
|
transform: rotate(135deg);
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
&__button {
|
||||||
|
width: 60px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 24px;
|
||||||
|
background: #1889f9;
|
||||||
|
border: none;
|
||||||
|
border-radius: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: darken(#1889f9, 10%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes version-tip {
|
||||||
|
from {
|
||||||
|
transform: scaleY(0);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: scaleY(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
20
docs/site/desktop/index.html
Normal file
20
docs/site/desktop/index.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
|
||||||
|
<meta http-Equiv="Cache-Control" Content="no-cache" />
|
||||||
|
<meta http-Equiv="Pragma" Content="no-cache" />
|
||||||
|
<meta http-Equiv="Expires" Content="0" />
|
||||||
|
<link rel="shortcut icon" href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico">
|
||||||
|
<link href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" rel="stylesheet" />
|
||||||
|
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
|
||||||
|
<script>window.Promise || document.write('<script src="//img.yzcdn.cn/huiyi/build/h5/js/pinkie.min.js"><\/script>');</script>
|
||||||
|
</head>
|
||||||
|
<body ontouchstart>
|
||||||
|
|
||||||
|
<div id="app"></div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,10 +1,9 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import VantDoc from '@vant/doc';
|
import VantDoc from '@vant/doc';
|
||||||
import routes from '../router';
|
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
import routes from '../router';
|
||||||
import { isMobile, importAll } from '../utils';
|
import { isMobile, importAll } from '../utils';
|
||||||
import '../sw';
|
|
||||||
|
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
location.replace('mobile.html' + location.hash);
|
location.replace('mobile.html' + location.hash);
|
||||||
@ -13,7 +12,7 @@ if (isMobile) {
|
|||||||
Vue.use(VueRouter).use(VantDoc);
|
Vue.use(VueRouter).use(VantDoc);
|
||||||
|
|
||||||
const docs = {};
|
const docs = {};
|
||||||
const docsFromMarkdown = require.context('../../../docs/markdown', false, /(en-US|zh-CN)\.md$/);
|
const docsFromMarkdown = require.context('../../markdown', false, /(en-US|zh-CN)\.md$/);
|
||||||
const docsFromPackages = require.context('../../../src', true, /README(\.zh-CN)?\.md$/);
|
const docsFromPackages = require.context('../../../src', true, /README(\.zh-CN)?\.md$/);
|
||||||
|
|
||||||
importAll(docs, docsFromMarkdown);
|
importAll(docs, docsFromMarkdown);
|
18
docs/site/mobile/index.html
Normal file
18
docs/site/mobile/index.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
|
||||||
|
<meta http-Equiv="Cache-Control" Content="no-cache" />
|
||||||
|
<meta http-Equiv="Pragma" Content="no-cache" />
|
||||||
|
<meta http-Equiv="Expires" Content="0" />
|
||||||
|
<link rel="shortcut icon" href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico">
|
||||||
|
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
|
||||||
|
<script>window.Promise || document.write('<script src="//img.yzcdn.cn/huiyi/build/h5/js/pinkie.min.js"><\/script>');</script>
|
||||||
|
</head>
|
||||||
|
<body ontouchstart>
|
||||||
|
|
||||||
|
<div id="app"></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -5,7 +5,6 @@ import App from './App';
|
|||||||
import routes from '../router';
|
import routes from '../router';
|
||||||
import { importAll } from '../utils';
|
import { importAll } from '../utils';
|
||||||
import '@vant/touch-emulator';
|
import '@vant/touch-emulator';
|
||||||
import '../sw';
|
|
||||||
|
|
||||||
const componentMap = {};
|
const componentMap = {};
|
||||||
const context = require.context('../../../src', true, /demo\/index.vue$/);
|
const context = require.context('../../../src', true, /demo\/index.vue$/);
|
17
package.json
17
package.json
@ -14,12 +14,12 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bootstrap": "yarn || npm i",
|
"bootstrap": "yarn || npm i",
|
||||||
"dev": "npm run build:entry && cd site && yarn serve",
|
"dev": "npm run build:entry && webpack-dev-server --config build/webpack.dev.js",
|
||||||
"lint": "eslint ./src --ext .js,.vue,.ts,.tsx && stylelint \"src/**/*.less\" --fix",
|
"lint": "eslint ./src --ext .js,.vue,.ts,.tsx && stylelint \"src/**/*.less\" --fix",
|
||||||
"build:entry": "node build/build-entry.js",
|
"build:entry": "node build/build-entry.js",
|
||||||
"build:changelog": "vant-doc changelog ./docs/markdown/changelog.generated.md --tag 2.0.0",
|
"build:changelog": "vant-doc changelog ./docs/markdown/changelog.generated.md --tag 2.0.0",
|
||||||
"build:lib": "node build/build-lib.js",
|
"build:lib": "node build/build-lib.js",
|
||||||
"build:site": "rm -rf site/dist && cd site && npm run build && gh-pages -d dist --add",
|
"build:site": "rm -rf docs/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js && gh-pages -d docs/dist --add",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:clear-cache": "jest --clearCache",
|
"test:clear-cache": "jest --clearCache",
|
||||||
@ -75,7 +75,6 @@
|
|||||||
"@vant/markdown-vetur": "^1.0.0",
|
"@vant/markdown-vetur": "^1.0.0",
|
||||||
"@vant/touch-emulator": "^1.1.0",
|
"@vant/touch-emulator": "^1.1.0",
|
||||||
"@vue/babel-preset-jsx": "^1.0.0",
|
"@vue/babel-preset-jsx": "^1.0.0",
|
||||||
"@vue/server-test-utils": "^1.0.0-beta.29",
|
|
||||||
"@vue/test-utils": "^1.0.0-beta.29",
|
"@vue/test-utils": "^1.0.0-beta.29",
|
||||||
"autoprefixer": "^9.6.0",
|
"autoprefixer": "^9.6.0",
|
||||||
"babel-jest": "^24.8.0",
|
"babel-jest": "^24.8.0",
|
||||||
@ -88,6 +87,7 @@
|
|||||||
"eslint": "^6.0.1",
|
"eslint": "^6.0.1",
|
||||||
"fast-glob": "^3.0.3",
|
"fast-glob": "^3.0.3",
|
||||||
"gh-pages": "^2.0.1",
|
"gh-pages": "^2.0.1",
|
||||||
|
"html-webpack-plugin": "3.2.0",
|
||||||
"husky": "^3.0.0",
|
"husky": "^3.0.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
"jest-serializer-vue": "^2.0.2",
|
"jest-serializer-vue": "^2.0.2",
|
||||||
@ -96,6 +96,7 @@
|
|||||||
"lint-staged": "^9.0.2",
|
"lint-staged": "^9.0.2",
|
||||||
"postcss": "^7.0.17",
|
"postcss": "^7.0.17",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
|
"progress-bar-webpack-plugin": "^1.12.1",
|
||||||
"shelljs": "^0.8.3",
|
"shelljs": "^0.8.3",
|
||||||
"signale": "^1.4.0",
|
"signale": "^1.4.0",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
@ -106,16 +107,14 @@
|
|||||||
"ts-jest": "^24.0.2",
|
"ts-jest": "^24.0.2",
|
||||||
"typescript": "^3.5.2",
|
"typescript": "^3.5.2",
|
||||||
"uppercamelcase": "^3.0.0",
|
"uppercamelcase": "^3.0.0",
|
||||||
"url-loader": "^2.0.1",
|
|
||||||
"vue": "2.6.10",
|
"vue": "2.6.10",
|
||||||
"vue-jest": "4.0.0-beta.1",
|
"vue-jest": "4.0.0-beta.2",
|
||||||
"vue-loader": "^15.7.0",
|
"vue-loader": "^15.7.0",
|
||||||
"vue-router": "^3.0.6",
|
"vue-router": "^3.0.7",
|
||||||
"vue-server-renderer": "^2.6.10",
|
|
||||||
"vue-template-compiler": "2.6.10",
|
"vue-template-compiler": "2.6.10",
|
||||||
"vue-template-es2015-compiler": "^1.9.1",
|
|
||||||
"webpack": "4.35.2",
|
"webpack": "4.35.2",
|
||||||
"webpack-cli": "^3.3.5"
|
"webpack-cli": "^3.3.5",
|
||||||
|
"webpack-dev-server": "3.7.2"
|
||||||
},
|
},
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"es/**/style/*",
|
"es/**/style/*",
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
presets: ['@vue/app']
|
|
||||||
};
|
|
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Vant",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"scripts": {
|
|
||||||
"serve": "vue-cli-service serve",
|
|
||||||
"build": "yarn && vue-cli-service build"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"core-js": "^2.6.5",
|
|
||||||
"register-service-worker": "^1.6.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@vue/cli-plugin-babel": "^3.1.1",
|
|
||||||
"@vue/cli-plugin-pwa": "^3.8.0",
|
|
||||||
"@vue/cli-plugin-typescript": "^3.8.1",
|
|
||||||
"@vue/cli-service": "^3.1.4"
|
|
||||||
},
|
|
||||||
"postcss": {
|
|
||||||
"plugins": {
|
|
||||||
"autoprefixer": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions"
|
|
||||||
]
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
@ -1,22 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta
|
|
||||||
name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
|
|
||||||
/>
|
|
||||||
<link
|
|
||||||
rel="shortcut icon"
|
|
||||||
href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico"
|
|
||||||
/>
|
|
||||||
<link href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" rel="stylesheet" />
|
|
||||||
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
|
|
||||||
</head>
|
|
||||||
<body ontouchstart>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
|
|
||||||
<!-- built files will be auto injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Vant",
|
|
||||||
"short_name": "Vant",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "./img/icons/android-chrome-192x192.png",
|
|
||||||
"sizes": "192x192",
|
|
||||||
"type": "image/png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "./img/icons/android-chrome-512x512.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": "./index.html",
|
|
||||||
"display": "standalone",
|
|
||||||
"background_color": "#000000",
|
|
||||||
"theme_color": "#4DBA87"
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta
|
|
||||||
name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
|
|
||||||
/>
|
|
||||||
<link
|
|
||||||
rel="shortcut icon"
|
|
||||||
href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico"
|
|
||||||
/>
|
|
||||||
<title>Vant - 轻量、可靠的移动端 Vue 组件库</title>
|
|
||||||
</head>
|
|
||||||
<body ontouchstart>
|
|
||||||
<div id="app"></div>
|
|
||||||
<!-- built files will be auto injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,74 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app">
|
|
||||||
<van-doc
|
|
||||||
:base="base"
|
|
||||||
:config="config"
|
|
||||||
:lang="$vantLang"
|
|
||||||
:github="github"
|
|
||||||
:versions="versions"
|
|
||||||
:simulators="simulators"
|
|
||||||
:search-config="searchConfig"
|
|
||||||
:current-simulator="currentSimulator"
|
|
||||||
@switch-version="onSwitchVersion"
|
|
||||||
>
|
|
||||||
<router-view @changeDemoURL="onChangeDemoURL" />
|
|
||||||
</van-doc>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import pkgJson from '../../package.json';
|
|
||||||
import docConfig, { github, versions, searchConfig } from '../doc.config';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
this.github = github;
|
|
||||||
this.versions = versions;
|
|
||||||
this.searchConfig = searchConfig;
|
|
||||||
|
|
||||||
return {
|
|
||||||
simulators: [`mobile.html${location.hash}`],
|
|
||||||
demoURL: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
base() {
|
|
||||||
return `/${this.$vantLang}`;
|
|
||||||
},
|
|
||||||
|
|
||||||
config() {
|
|
||||||
return docConfig[this.$vantLang];
|
|
||||||
},
|
|
||||||
|
|
||||||
currentSimulator() {
|
|
||||||
const { name } = this.$route;
|
|
||||||
return name && name.indexOf('demo') !== -1 ? 1 : 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onChangeDemoURL(url) {
|
|
||||||
this.simulators = [this.simulators[0], url];
|
|
||||||
},
|
|
||||||
|
|
||||||
onSwitchVersion(version) {
|
|
||||||
if (version !== pkgJson.version) {
|
|
||||||
location.href = `https://youzan.github.io/vant/${version}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
.van-doc-intro {
|
|
||||||
padding-top: 20px;
|
|
||||||
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,7 +0,0 @@
|
|||||||
/* eslint-disable no-console */
|
|
||||||
|
|
||||||
import { register } from 'register-service-worker';
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
register(`${process.env.BASE_URL}service-worker.js`, {});
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"include": [
|
|
||||||
"../types/**/*",
|
|
||||||
"../src/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? '/vant/' : '/',
|
|
||||||
productionSourceMap: false,
|
|
||||||
pages: {
|
|
||||||
index: 'src/desktop/main.js',
|
|
||||||
mobile: 'src/mobile/main.js'
|
|
||||||
},
|
|
||||||
chainWebpack: config => config.resolve.extensions.prepend('.md'),
|
|
||||||
configureWebpack: {
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.md$/,
|
|
||||||
use: ['vue-loader', '@vant/markdown-loader']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
css: {
|
|
||||||
loaderOptions: {
|
|
||||||
less: {
|
|
||||||
paths: [path.resolve(__dirname, '../node_modules')]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
7812
site/yarn.lock
7812
site/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -5,19 +5,19 @@ exports[`create a AddressEdit 1`] = `
|
|||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>姓名</span></div>
|
<div class="van-cell__title van-field__label"><span>姓名</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" placeholder="收货人姓名" value="" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" placeholder="收货人姓名" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>电话</span></div>
|
<div class="van-cell__title van-field__label"><span>电话</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" value="" class="van-field__control"></div>
|
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>地区</span></div>
|
<div class="van-cell__title van-field__label"><span>地区</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" placeholder="选择省 / 市 / 区" readonly="readonly" value="" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" placeholder="选择省 / 市 / 区" readonly="readonly" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-address-edit-detail">
|
<div class="van-cell van-address-edit-detail">
|
||||||
@ -31,29 +31,6 @@ exports[`create a AddressEdit 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">保存</span></button></div>
|
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">保存</span></button></div>
|
||||||
<div name="van-popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
|
|
||||||
<div class="van-picker van-area">
|
|
||||||
<div class="van-hairline--top-bottom van-picker__toolbar">
|
|
||||||
<div role="button" tabindex="0" class="van-picker__cancel">取消</div>
|
|
||||||
<div role="button" tabindex="0" class="van-picker__confirm">确认</div>
|
|
||||||
</div>
|
|
||||||
<div class="van-loading van-loading--circular van-picker__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color:#1989fa;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
|
|
||||||
<div class="van-picker__columns" style="height:220px;">
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker__mask" style="background-size:100% 88px;"></div>
|
|
||||||
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
|
|
||||||
</div>
|
|
||||||
<!---->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -62,19 +39,19 @@ exports[`create a AddressEdit with props 1`] = `
|
|||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>姓名</span></div>
|
<div class="van-cell__title van-field__label"><span>姓名</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" placeholder="收货人姓名" value="测试" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" placeholder="收货人姓名" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>电话</span></div>
|
<div class="van-cell__title van-field__label"><span>电话</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" value="13000000000" class="van-field__control"></div>
|
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>地区</span></div>
|
<div class="van-cell__title van-field__label"><span>地区</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" placeholder="选择省 / 市 / 区" readonly="readonly" value="北京市/朝阳区" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" placeholder="选择省 / 市 / 区" readonly="readonly" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-address-edit-detail">
|
<div class="van-cell van-address-edit-detail">
|
||||||
@ -82,7 +59,7 @@ exports[`create a AddressEdit with props 1`] = `
|
|||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>详细地址</span></div>
|
<div class="van-cell__title van-field__label"><span>详细地址</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control">详细地址</textarea></div>
|
<div class="van-field__body"><textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control"></textarea></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -90,40 +67,17 @@ exports[`create a AddressEdit with props 1`] = `
|
|||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label"><span>邮政编码</span></div>
|
<div class="van-cell__title van-field__label"><span>邮政编码</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="tel" maxlength="6" placeholder="邮政编码" value="10000" class="van-field__control"></div>
|
<div class="van-field__body"><input type="tel" maxlength="6" placeholder="邮政编码" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center van-switch-cell">
|
<div class="van-cell van-cell--center van-switch-cell">
|
||||||
<div class="van-cell__title"><span>设为默认收货地址</span></div>
|
<div class="van-cell__title"><span>设为默认收货地址</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div role="switch" aria-checked="true" class="van-switch van-switch--on" style="font-size:24px;">
|
<div role="switch" aria-checked="true" class="van-switch van-switch--on" style="font-size: 24px;">
|
||||||
<div class="van-switch__node"></div>
|
<div class="van-switch__node"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">保存</span></button></div>
|
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">保存</span></button></div>
|
||||||
<div name="van-popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
|
|
||||||
<div class="van-picker van-area">
|
|
||||||
<div class="van-hairline--top-bottom van-picker__toolbar">
|
|
||||||
<div role="button" tabindex="0" class="van-picker__cancel">取消</div>
|
|
||||||
<div role="button" tabindex="0" class="van-picker__confirm">确认</div>
|
|
||||||
</div>
|
|
||||||
<!---->
|
|
||||||
<div class="van-picker__columns" style="height:220px;">
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker-column">
|
|
||||||
<ul class="van-picker-column__wrapper" style="transform:translate3d(0, 88px, 0);transition-duration:0ms;transition-property:none;line-height:44px;"></ul>
|
|
||||||
</div>
|
|
||||||
<div class="van-picker__mask" style="background-size:100% 88px;"></div>
|
|
||||||
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
|
|
||||||
</div>
|
|
||||||
<!---->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
import { renderToString } from '@vue/server-test-utils';
|
|
||||||
import AddressEdit from '..';
|
import AddressEdit from '..';
|
||||||
import areaList from '../../area/demo/area.simple';
|
import areaList from '../../area/demo/area.simple';
|
||||||
import { mount, later, transitionStub } from '../../../test/utils';
|
import { mount, later, transitionStub } from '../../../test/utils';
|
||||||
@ -41,11 +40,11 @@ const createComponent = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test('create a AddressEdit', () => {
|
test('create a AddressEdit', () => {
|
||||||
expect(renderToString(AddressEdit)).toMatchSnapshot();
|
expect(mount(AddressEdit)).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('create a AddressEdit with props', () => {
|
test('create a AddressEdit with props', () => {
|
||||||
const wrapper = renderToString(AddressEdit, {
|
const wrapper = mount(AddressEdit, {
|
||||||
propsData: {
|
propsData: {
|
||||||
areaList,
|
areaList,
|
||||||
addressInfo,
|
addressInfo,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import '../site/src/mobile/demo-common';
|
import '../docs/site/mobile/demo-common';
|
||||||
import Locale from '../src/locale';
|
import Locale from '../src/locale';
|
||||||
import { mount, later } from './utils';
|
import { mount, later } from './utils';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user