chore: simple demo (#1918)

pull/1933/head 1.5.0-rc.6
Amour1688 2020-03-23 11:00:24 +08:00 committed by GitHub
parent 36d95b18fd
commit 60bb3ae50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 220 additions and 6 deletions

26
examples/App.vue Normal file
View File

@ -0,0 +1,26 @@
<template>
<div>
<a-button type="primary">
Primary
</a-button>
<a-button>Default</a-button>
<a-button type="dashed">
Dashed
</a-button>
<a-button type="danger">
Danger
</a-button>
<a-button type="primary">
按钮
</a-button>
<a-button type="link">
Link
</a-button>
</div>
</template>
<script>
export default {
name: 'Demo',
};
</script>

81
examples/index.html Normal file
View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<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" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta
name="description"
content="An enterprise-class UI components based on Ant Design and Vue"
/>
<title>Ant Design Vue</title>
<meta
name="keywords"
content="ant design vue,ant-design-vue,ant-design-vue admin,ant design pro,vue ant design,vue ant design pro,vue ant design admin,ant design vue官网,ant design vue中文文档,ant design vue文档"
/>
<link rel="shortcut icon" type="image/x-icon" href="https://qn.antdv.com/favicon.ico" />
<style id="nprogress-style">
#nprogress {
display: none;
}
</style>
<script>
if (location.host === 'ant-design-vue.gitee.io' || location.host === 'vue.ant.design') {
location.replace(location.href.replace(location.host, 'www.antdv.com'));
}
var _hmt = _hmt || [];
var srcMap = {
'ant-design-vue.gitee.io': 'https://hm.baidu.com/hm.js?1e30265f06f76fabfcdb7ed272017441',
'vue.ant.design': 'https://hm.baidu.com/hm.js?f0ba868f114e674b816b4880f7525811',
'www.antdv.com': 'https://hm.baidu.com/hm.js?4ad38a0c8f0960d731b654425317da22',
};
var src =
srcMap[location.host] || 'https://hm.baidu.com/hm.js?4ad38a0c8f0960d731b654425317da22';
(function() {
var hm = document.createElement('script');
hm.src = src;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body>
<div id="app"></div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-151755889-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-151755889-1');
</script>
<!-- Hotjar Tracking Code for http://vue.ant.design -->
<script>
(function(h, o, t, j, a, r) {
if (location.href.indexOf('iframe') === -1) {
h.hj =
h.hj ||
function() {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = {
hjid: 1359441,
hjsv: 6,
};
a = o.getElementsByTagName('head')[0];
r = o.createElement('script');
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
}
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
</script>
</body>
</html>

11
examples/index.js Normal file
View File

@ -0,0 +1,11 @@
import 'babel-polyfill';
import Vue from 'vue';
import App from './App.vue';
import { Button } from 'ant-design-vue';
Vue.use(Button);
new Vue({
el: '#app',
render: h => h(App),
});

View File

@ -26,7 +26,7 @@
"scripts"
],
"scripts": {
"dev": "node build/dev.js",
"dev": "webpack-dev-server",
"start": "cross-env PORT=3001 NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
"test": "cross-env NODE_ENV=test jest --config .jest.js",
"compile": "node antd-tools/cli/run.js compile",
@ -109,7 +109,6 @@
"gulp": "^4.0.1",
"gulp-babel": "^7.0.0",
"gulp-strip-code": "^0.1.4",
"highlight.js": "^9.12.0",
"html-webpack-plugin": "^3.2.0",
"husky": "^4.0.0",
"istanbul-instrumenter-loader": "^3.0.0",
@ -123,8 +122,6 @@
"less-loader": "^5.0.0",
"less-plugin-npm-import": "^2.1.0",
"lint-staged": "^10.0.0",
"markdown-it": "^10.0.0",
"markdown-it-anchor": "^5.0.0",
"marked": "0.3.18",
"merge2": "^1.2.1",
"mini-css-extract-plugin": "^0.9.0",
@ -137,7 +134,6 @@
"postcss-loader": "^3.0.0",
"prettier": "^1.18.2",
"pretty-quick": "^2.0.0",
"prismjs": "^1.19.0",
"querystring": "^0.2.0",
"raw-loader": "^4.0.0",
"reqwest": "^2.0.5",
@ -215,4 +211,4 @@
"lib/**/style/*",
"*.less"
]
}
}

100
webpack.config.js Normal file
View File

@ -0,0 +1,100 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const webpack = require('webpack');
const WebpackBar = require('webpackbar');
const path = require('path');
module.exports = {
mode: 'development',
entry: {
app: './examples/index.js',
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
options: {
presets: [
[
'env',
{
targets: {
browsers: [
'last 2 versions',
'Firefox ESR',
'> 1%',
'ie >= 9',
'iOS >= 8',
'Android >= 4',
],
},
},
],
],
plugins: [
// libraryDirectory is "", because webpack alias doesn't seem to allow '/'
['import', { libraryName: 'ant-design-vue', style: true, libraryDirectory: '' }],
'transform-vue-jsx',
'transform-object-assign',
'transform-object-rest-spread',
'transform-class-properties',
],
},
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
},
},
{
test: /\.less$/,
use: [
{ loader: 'vue-style-loader' },
{
loader: 'css-loader',
options: { sourceMap: true },
},
{ loader: 'less-loader', options: { sourceMap: true, javascriptEnabled: true } },
],
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader'],
},
],
},
resolve: {
alias: {
'ant-design-vue': path.join(__dirname, './components'),
},
extensions: ['.js', '.jsx', '.vue'],
},
devServer: {
host: 'localhost',
port: 3000,
historyApiFallback: {
rewrites: [{ from: /./, to: '/index.html' }],
},
disableHostCheck: true,
hot: true,
open: true,
},
devtool: '#source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: 'examples/index.html',
filename: 'index.html',
inject: true,
}),
new VueLoaderPlugin(),
new WebpackBar(),
],
};