Skip to content

Commit 60bb3ae

Browse files
authored
chore: simple demo (#1918)
1 parent 36d95b1 commit 60bb3ae

File tree

5 files changed

+220
-6
lines changed

5 files changed

+220
-6
lines changed

examples/App.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div>
3+
<a-button type="primary">
4+
Primary
5+
</a-button>
6+
<a-button>Default</a-button>
7+
<a-button type="dashed">
8+
Dashed
9+
</a-button>
10+
<a-button type="danger">
11+
Danger
12+
</a-button>
13+
<a-button type="primary">
14+
按钮
15+
</a-button>
16+
<a-button type="link">
17+
Link
18+
</a-button>
19+
</div>
20+
</template>
21+
22+
<script>
23+
export default {
24+
name: 'Demo',
25+
};
26+
</script>

examples/index.html

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
8+
<meta http-equiv="Pragma" content="no-cache" />
9+
<meta http-equiv="Expires" content="0" />
10+
<meta
11+
name="description"
12+
content="An enterprise-class UI components based on Ant Design and Vue"
13+
/>
14+
<title>Ant Design Vue</title>
15+
<meta
16+
name="keywords"
17+
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文档"
18+
/>
19+
<link rel="shortcut icon" type="image/x-icon" href="https://qn.antdv.com/favicon.ico" />
20+
<style id="nprogress-style">
21+
#nprogress {
22+
display: none;
23+
}
24+
</style>
25+
<script>
26+
if (location.host === 'ant-design-vue.gitee.io' || location.host === 'vue.ant.design') {
27+
location.replace(location.href.replace(location.host, 'www.antdv.com'));
28+
}
29+
var _hmt = _hmt || [];
30+
var srcMap = {
31+
'ant-design-vue.gitee.io': 'https://hm.baidu.com/hm.js?1e30265f06f76fabfcdb7ed272017441',
32+
'vue.ant.design': 'https://hm.baidu.com/hm.js?f0ba868f114e674b816b4880f7525811',
33+
'www.antdv.com': 'https://hm.baidu.com/hm.js?4ad38a0c8f0960d731b654425317da22',
34+
};
35+
var src =
36+
srcMap[location.host] || 'https://hm.baidu.com/hm.js?4ad38a0c8f0960d731b654425317da22';
37+
(function() {
38+
var hm = document.createElement('script');
39+
hm.src = src;
40+
var s = document.getElementsByTagName('script')[0];
41+
s.parentNode.insertBefore(hm, s);
42+
})();
43+
</script>
44+
</head>
45+
46+
<body>
47+
<div id="app"></div>
48+
<!-- Global site tag (gtag.js) - Google Analytics -->
49+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-151755889-1"></script>
50+
<script>
51+
window.dataLayer = window.dataLayer || [];
52+
function gtag() {
53+
dataLayer.push(arguments);
54+
}
55+
gtag('js', new Date());
56+
57+
gtag('config', 'UA-151755889-1');
58+
</script>
59+
<!-- Hotjar Tracking Code for http://vue.ant.design -->
60+
<script>
61+
(function(h, o, t, j, a, r) {
62+
if (location.href.indexOf('iframe') === -1) {
63+
h.hj =
64+
h.hj ||
65+
function() {
66+
(h.hj.q = h.hj.q || []).push(arguments);
67+
};
68+
h._hjSettings = {
69+
hjid: 1359441,
70+
hjsv: 6,
71+
};
72+
a = o.getElementsByTagName('head')[0];
73+
r = o.createElement('script');
74+
r.async = 1;
75+
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
76+
a.appendChild(r);
77+
}
78+
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
79+
</script>
80+
</body>
81+
</html>

examples/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import 'babel-polyfill';
2+
import Vue from 'vue';
3+
import App from './App.vue';
4+
import { Button } from 'ant-design-vue';
5+
6+
Vue.use(Button);
7+
8+
new Vue({
9+
el: '#app',
10+
render: h => h(App),
11+
});

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"scripts"
2727
],
2828
"scripts": {
29-
"dev": "node build/dev.js",
29+
"dev": "webpack-dev-server",
3030
"start": "cross-env PORT=3001 NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
3131
"test": "cross-env NODE_ENV=test jest --config .jest.js",
3232
"compile": "node antd-tools/cli/run.js compile",
@@ -109,7 +109,6 @@
109109
"gulp": "^4.0.1",
110110
"gulp-babel": "^7.0.0",
111111
"gulp-strip-code": "^0.1.4",
112-
"highlight.js": "^9.12.0",
113112
"html-webpack-plugin": "^3.2.0",
114113
"husky": "^4.0.0",
115114
"istanbul-instrumenter-loader": "^3.0.0",
@@ -123,8 +122,6 @@
123122
"less-loader": "^5.0.0",
124123
"less-plugin-npm-import": "^2.1.0",
125124
"lint-staged": "^10.0.0",
126-
"markdown-it": "^10.0.0",
127-
"markdown-it-anchor": "^5.0.0",
128125
"marked": "0.3.18",
129126
"merge2": "^1.2.1",
130127
"mini-css-extract-plugin": "^0.9.0",
@@ -137,7 +134,6 @@
137134
"postcss-loader": "^3.0.0",
138135
"prettier": "^1.18.2",
139136
"pretty-quick": "^2.0.0",
140-
"prismjs": "^1.19.0",
141137
"querystring": "^0.2.0",
142138
"raw-loader": "^4.0.0",
143139
"reqwest": "^2.0.5",
@@ -215,4 +211,4 @@
215211
"lib/**/style/*",
216212
"*.less"
217213
]
218-
}
214+
}

webpack.config.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
const VueLoaderPlugin = require('vue-loader/lib/plugin');
3+
const webpack = require('webpack');
4+
const WebpackBar = require('webpackbar');
5+
const path = require('path');
6+
7+
module.exports = {
8+
mode: 'development',
9+
entry: {
10+
app: './examples/index.js',
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.vue$/,
16+
loader: 'vue-loader',
17+
},
18+
{
19+
test: /\.(js|jsx)$/,
20+
loader: 'babel-loader',
21+
options: {
22+
presets: [
23+
[
24+
'env',
25+
{
26+
targets: {
27+
browsers: [
28+
'last 2 versions',
29+
'Firefox ESR',
30+
'> 1%',
31+
'ie >= 9',
32+
'iOS >= 8',
33+
'Android >= 4',
34+
],
35+
},
36+
},
37+
],
38+
],
39+
plugins: [
40+
// libraryDirectory is "", because webpack alias doesn't seem to allow '/'
41+
['import', { libraryName: 'ant-design-vue', style: true, libraryDirectory: '' }],
42+
'transform-vue-jsx',
43+
'transform-object-assign',
44+
'transform-object-rest-spread',
45+
'transform-class-properties',
46+
],
47+
},
48+
},
49+
{
50+
test: /\.(png|jpg|gif|svg)$/,
51+
loader: 'file-loader',
52+
options: {
53+
name: '[name].[ext]?[hash]',
54+
},
55+
},
56+
{
57+
test: /\.less$/,
58+
use: [
59+
{ loader: 'vue-style-loader' },
60+
{
61+
loader: 'css-loader',
62+
options: { sourceMap: true },
63+
},
64+
{ loader: 'less-loader', options: { sourceMap: true, javascriptEnabled: true } },
65+
],
66+
},
67+
{
68+
test: /\.css$/,
69+
use: ['vue-style-loader', 'css-loader'],
70+
},
71+
],
72+
},
73+
resolve: {
74+
alias: {
75+
'ant-design-vue': path.join(__dirname, './components'),
76+
},
77+
extensions: ['.js', '.jsx', '.vue'],
78+
},
79+
devServer: {
80+
host: 'localhost',
81+
port: 3000,
82+
historyApiFallback: {
83+
rewrites: [{ from: /./, to: '/index.html' }],
84+
},
85+
disableHostCheck: true,
86+
hot: true,
87+
open: true,
88+
},
89+
devtool: '#source-map',
90+
plugins: [
91+
new webpack.HotModuleReplacementPlugin(),
92+
new HtmlWebpackPlugin({
93+
template: 'examples/index.html',
94+
filename: 'index.html',
95+
inject: true,
96+
}),
97+
new VueLoaderPlugin(),
98+
new WebpackBar(),
99+
],
100+
};

0 commit comments

Comments
 (0)