mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
chore: remove unused site files
This commit is contained in:
parent
8d01c3c641
commit
e9bab1bc39
@ -4,9 +4,8 @@ module.exports = {
|
|||||||
'@babel/preset-env',
|
'@babel/preset-env',
|
||||||
{
|
{
|
||||||
loose: true,
|
loose: true,
|
||||||
modules: false
|
modules: false,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
plugins: ['@babel/plugin-syntax-dynamic-import']
|
|
||||||
};
|
};
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
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/src/index.js',
|
|
||||||
'vant-preview': './docs/src/preview.js',
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: path.join(__dirname, '../docs/dist'),
|
|
||||||
publicPath: '/',
|
|
||||||
chunkFilename: 'async_[name].js',
|
|
||||||
},
|
|
||||||
stats: {
|
|
||||||
modules: false,
|
|
||||||
children: false,
|
|
||||||
},
|
|
||||||
serve: {
|
|
||||||
open: true,
|
|
||||||
host: '0.0.0.0',
|
|
||||||
devMiddleware: {
|
|
||||||
logLevel: 'warn',
|
|
||||||
},
|
|
||||||
hotClient: {
|
|
||||||
logLevel: 'warn',
|
|
||||||
allEntries: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.vue', '.css'],
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'vue-loader',
|
|
||||||
options: {
|
|
||||||
compilerOptions: {
|
|
||||||
preserveWhitespace: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: 'babel-loader',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(css|less)$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'postcss-loader', 'less-loader'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.md$/,
|
|
||||||
use: ['vue-loader', '@vant/markdown-loader'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new VueLoaderPlugin(),
|
|
||||||
new ProgressBarPlugin(),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ['vant-docs'],
|
|
||||||
template: 'docs/src/index.tpl',
|
|
||||||
filename: 'index.html',
|
|
||||||
inject: true,
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ['vant-preview'],
|
|
||||||
template: 'docs/src/index.tpl',
|
|
||||||
filename: 'preview.html',
|
|
||||||
inject: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
@ -1,14 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const config = require('./webpack.doc.dev.js');
|
|
||||||
|
|
||||||
delete config.serve;
|
|
||||||
|
|
||||||
module.exports = Object.assign(config, {
|
|
||||||
mode: 'production',
|
|
||||||
output: {
|
|
||||||
path: path.join(__dirname, '../docs/dist'),
|
|
||||||
publicPath: 'https://b.yzcdn.cn/vant-weapp/',
|
|
||||||
filename: '[name].[hash:8].js',
|
|
||||||
chunkFilename: 'async_[name].[chunkhash:8].js',
|
|
||||||
},
|
|
||||||
});
|
|
@ -1,85 +0,0 @@
|
|||||||
<template>
|
|
||||||
<van-doc
|
|
||||||
active="小程序组件"
|
|
||||||
:config="config"
|
|
||||||
:github="github"
|
|
||||||
:versions="versions"
|
|
||||||
:simulator="simulator"
|
|
||||||
@switch-version="onSwitchVersion"
|
|
||||||
>
|
|
||||||
<router-view />
|
|
||||||
</van-doc>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import pkgJson from '../../package.json';
|
|
||||||
import docConfig, { github, versions } from './doc.config';
|
|
||||||
|
|
||||||
const UNSHARED = ['common', 'quickstart', 'changelog', 'intro', 'transition'];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
github,
|
|
||||||
versions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
config() {
|
|
||||||
return docConfig;
|
|
||||||
},
|
|
||||||
|
|
||||||
simulator() {
|
|
||||||
let prefix = '';
|
|
||||||
const { path } = this.$route.meta;
|
|
||||||
|
|
||||||
if (
|
|
||||||
location.hostname === '0.0.0.0' ||
|
|
||||||
location.hostname === 'localhost'
|
|
||||||
) {
|
|
||||||
prefix = 'https://youzan.github.io';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UNSHARED.includes(path)) {
|
|
||||||
return `${prefix}/vant/mobile.html?hide_nav=1&weapp=1#/zh-CN/${path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `./preview.html#${path}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onSwitchVersion(version) {
|
|
||||||
if (version !== pkgJson.version) {
|
|
||||||
location.href = `https://youzan.github.io/vant-weapp/${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;
|
|
||||||
|
|
||||||
&__logo {
|
|
||||||
width: 120px;
|
|
||||||
height: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 32px;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
color: #455a64;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<img
|
|
||||||
:class="['preview-image', `preview-image--${imageName}`]"
|
|
||||||
:src="image"
|
|
||||||
/>
|
|
||||||
<div class="preview-popup">
|
|
||||||
<div class="preview-content">
|
|
||||||
<img src="https://img.yzcdn.cn/vant-weapp/qrcode-201808101114.jpg" />
|
|
||||||
<p>微信扫码体验</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const PREFIX = 'https://img.yzcdn.cn/vant-weapp/';
|
|
||||||
const MAP = {
|
|
||||||
index: 'index-20190715.png',
|
|
||||||
transition: 'transition-20180821.png',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
imageName() {
|
|
||||||
return location.hash.slice(1);
|
|
||||||
},
|
|
||||||
image() {
|
|
||||||
return PREFIX + (MAP[this.imageName] || MAP.index);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
color: #323233;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
|
|
||||||
Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB',
|
|
||||||
'Microsoft Yahei', sans-serif;
|
|
||||||
line-height: 1;
|
|
||||||
background-color: #f7f8fa;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview {
|
|
||||||
&-image {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
&--transition {
|
|
||||||
margin-top: -62px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-popup {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: rgba(255, 255, 255, 0.95);
|
|
||||||
opacity: 0;
|
|
||||||
transition: 0.3s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-content {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 200px;
|
|
||||||
text-align: center;
|
|
||||||
transform: translateY(-60%);
|
|
||||||
user-select: none;
|
|
||||||
|
|
||||||
img {
|
|
||||||
display: inline-block;
|
|
||||||
width: 180px;
|
|
||||||
height: 180px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
color: #34495e;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,74 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import packageJson from '../../package.json';
|
|
||||||
import components from '../../example/config';
|
|
||||||
const { version } = packageJson;
|
|
||||||
|
|
||||||
export const github = 'https://github.com/youzan/vant-weapp';
|
|
||||||
|
|
||||||
export const versions = [version, '0.x'];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
header: {
|
|
||||||
logo: {
|
|
||||||
image: 'https://img.yzcdn.cn/vant/logo.png',
|
|
||||||
title: 'Vant Weapp',
|
|
||||||
href: '#/',
|
|
||||||
},
|
|
||||||
nav: {
|
|
||||||
logoLink: [
|
|
||||||
{
|
|
||||||
image: 'https://img.yzcdn.cn/vant/vant-o.svg',
|
|
||||||
url: '/vant',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image: 'https://img.yzcdn.cn/vant/logo/github.svg',
|
|
||||||
url: github,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
nav: [
|
|
||||||
{
|
|
||||||
name: '开发指南',
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
path: '/intro',
|
|
||||||
title: '介绍',
|
|
||||||
md: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/quickstart',
|
|
||||||
title: '快速上手',
|
|
||||||
md: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/changelog',
|
|
||||||
title: '更新日志',
|
|
||||||
md: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/common',
|
|
||||||
title: '内置样式',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/custom-style',
|
|
||||||
title: '样式覆盖',
|
|
||||||
md: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/theme',
|
|
||||||
title: '定制主题',
|
|
||||||
md: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '组件',
|
|
||||||
groups: components,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
@ -1,55 +0,0 @@
|
|||||||
import Vue from 'vue';
|
|
||||||
import VueRouter from 'vue-router';
|
|
||||||
import App from './App';
|
|
||||||
import routes from './router';
|
|
||||||
import VantDoc from '@vant/doc';
|
|
||||||
|
|
||||||
Vue.use(VueRouter).use(VantDoc);
|
|
||||||
|
|
||||||
const router = new VueRouter({
|
|
||||||
mode: 'hash',
|
|
||||||
routes: routes(),
|
|
||||||
scrollBehavior(to) {
|
|
||||||
if (to.hash) {
|
|
||||||
return { selector: to.hash };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { x: 0, y: 0 };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const ua = navigator.userAgent.toLowerCase();
|
|
||||||
const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
|
|
||||||
|
|
||||||
router.beforeEach((route, redirect, next) => {
|
|
||||||
if (isMobile) {
|
|
||||||
location.replace('/vant/mobile.html?weapp=1');
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
router.afterEach(() => {
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
|
||||||
|
|
||||||
new Vue({
|
|
||||||
el: '#app',
|
|
||||||
mounted() {
|
|
||||||
setTimeout(() => {
|
|
||||||
// wait page init
|
|
||||||
if (this.$route.hash) {
|
|
||||||
const el = document.querySelector(this.$route.hash);
|
|
||||||
if (el) {
|
|
||||||
el.scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
},
|
|
||||||
render: (h) => h(App),
|
|
||||||
router,
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
import Vue from 'vue';
|
|
||||||
import Preview from './Preview.vue';
|
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
|
||||||
|
|
||||||
new Vue({
|
|
||||||
el: '#app',
|
|
||||||
render: (h) => h(Preview),
|
|
||||||
});
|
|
@ -1,52 +0,0 @@
|
|||||||
import docConfig from './doc.config';
|
|
||||||
|
|
||||||
const registerRoute = () => {
|
|
||||||
const route = [
|
|
||||||
{
|
|
||||||
path: '*',
|
|
||||||
redirect: () => `/intro`,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const navs = docConfig.nav || [];
|
|
||||||
|
|
||||||
function addRoute(page) {
|
|
||||||
let { path } = page;
|
|
||||||
if (path) {
|
|
||||||
path = path.replace('/', '');
|
|
||||||
|
|
||||||
const component = () =>
|
|
||||||
page.md
|
|
||||||
? import(`../markdown/${path}.md`)
|
|
||||||
: import(`../../packages/${path}/README.md`);
|
|
||||||
|
|
||||||
if (!component) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
route.push({
|
|
||||||
name: '/' + path,
|
|
||||||
component,
|
|
||||||
path: `/${path}`,
|
|
||||||
meta: {
|
|
||||||
path,
|
|
||||||
name: page.title,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
navs.forEach((nav) => {
|
|
||||||
if (nav.groups) {
|
|
||||||
nav.groups.forEach((group) => {
|
|
||||||
group.list.forEach((page) => addRoute(page));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addRoute(nav);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return route;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default registerRoute;
|
|
@ -47,6 +47,7 @@
|
|||||||
"gulp-rename": "^2.0.0",
|
"gulp-rename": "^2.0.0",
|
||||||
"miniprogram-api-typings": "^3.1.6",
|
"miniprogram-api-typings": "^3.1.6",
|
||||||
"miniprogram-ci": "^1.0.27",
|
"miniprogram-ci": "^1.0.27",
|
||||||
|
"less": "^3.0.0",
|
||||||
"tscpaths": "^0.0.9",
|
"tscpaths": "^0.0.9",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
"@vue/compiler-sfc": "^3.0.0"
|
"@vue/compiler-sfc": "^3.0.0"
|
||||||
|
16
yarn.lock
16
yarn.lock
@ -10264,6 +10264,22 @@ less-loader@^7.2.1:
|
|||||||
native-request "^1.0.5"
|
native-request "^1.0.5"
|
||||||
source-map "~0.6.0"
|
source-map "~0.6.0"
|
||||||
|
|
||||||
|
less@^3.0.0:
|
||||||
|
version "3.13.1"
|
||||||
|
resolved "https://registry.npmjs.org/less/-/less-3.13.1.tgz#0ebc91d2a0e9c0c6735b83d496b0ab0583077909"
|
||||||
|
integrity sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw==
|
||||||
|
dependencies:
|
||||||
|
copy-anything "^2.0.1"
|
||||||
|
tslib "^1.10.0"
|
||||||
|
optionalDependencies:
|
||||||
|
errno "^0.1.1"
|
||||||
|
graceful-fs "^4.1.2"
|
||||||
|
image-size "~0.5.0"
|
||||||
|
make-dir "^2.1.0"
|
||||||
|
mime "^1.4.1"
|
||||||
|
native-request "^1.0.5"
|
||||||
|
source-map "~0.6.0"
|
||||||
|
|
||||||
less@^4.1.0:
|
less@^4.1.0:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.npm.taobao.org/less/download/less-4.1.1.tgz?cache=0&sync_timestamp=1612065678706&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fless%2Fdownload%2Fless-4.1.1.tgz#15bf253a9939791dc690888c3ff424f3e6c7edba"
|
resolved "https://registry.npm.taobao.org/less/download/less-4.1.1.tgz?cache=0&sync_timestamp=1612065678706&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fless%2Fdownload%2Fless-4.1.1.tgz#15bf253a9939791dc690888c3ff424f3e6c7edba"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user