diff --git a/app/controller/test.ts b/app/controller/test.ts new file mode 100644 index 0000000..4bf96d7 --- /dev/null +++ b/app/controller/test.ts @@ -0,0 +1,8 @@ +import { Controller, Context } from 'egg'; + +export default class TestController extends Controller { + + public async vant(ctx: Context) { + await ctx.render('vant.js', {}); + } +} \ No newline at end of file diff --git a/app/router.ts b/app/router.ts index ef5503e..6425e49 100644 --- a/app/router.ts +++ b/app/router.ts @@ -8,6 +8,7 @@ export default (application: Application) => { router.post('/admin/api/article/del', controller.admin.del); router.get('/admin/api/article/:id', controller.admin.detail); router.get('/', controller.admin.login); + router.get('/test/vant', controller.test.vant); router.get('/admin', controller.admin.home); router.get('/admin/*', controller.admin.home); }; \ No newline at end of file diff --git a/app/web/page/vant/index.ts b/app/web/page/vant/index.ts new file mode 100644 index 0000000..abf8a6e --- /dev/null +++ b/app/web/page/vant/index.ts @@ -0,0 +1,15 @@ +import { Vue, Component, Prop } from 'vue-property-decorator'; +import { Action } from 'vuex-class'; +import { Button } from 'vant'; +// @ts-ignore +import Layout from '../../component/layout/index.vue'; + +@Component({ + components: { + Layout, + Button + } +}) +export default class Index extends Vue { + +} \ No newline at end of file diff --git a/app/web/page/vant/index.vue b/app/web/page/vant/index.vue new file mode 100644 index 0000000..c30022d --- /dev/null +++ b/app/web/page/vant/index.vue @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/package.json b/package.json index 9c1108f..4b29575 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "shortid": "^2.2.8", "showdown": "^1.8.6", "simplemde": "^1.11.2", + "vant": "^2.9.3", "vue": "^2.5.0", "vue-property-decorator": "^7.2.0", "vue-router": "^3.0.1", @@ -44,18 +45,19 @@ "vuex-router-sync": "^5.0.0" }, "devDependencies": { + "@easy-team/easywebpack-cli": "^4.0.0", + "@easy-team/easywebpack-vue": "^4.0.0", "@types/lodash": "^4.14.117", "@types/lowdb": "^1.0.6", "@types/node": "^10.12.0", "@types/shortid": "^0.0.29", "cz-conventional-changelog": "^2.1.0", - "@easy-team/easywebpack-cli": "^4.0.0", - "@easy-team/easywebpack-vue": "^4.0.0", "egg-bin": "^4.9.0", "egg-scripts": "^2.10.0", "egg-ts-helper": "^1.13.0", "imagemin-webpack-plugin": "^2.4.2", "node-tool-utils": "^1.1.1", + "ts-import-plugin": "^1.6.6", "ts-loader": "^5.3.0", "ts-node": "^7.0.1", "tslint": "^5.9.1", diff --git a/typings/app/controller/index.d.ts b/typings/app/controller/index.d.ts index 5a7e4c3..d26ca02 100644 --- a/typings/app/controller/index.d.ts +++ b/typings/app/controller/index.d.ts @@ -3,9 +3,11 @@ import 'egg'; import ExportAdmin from '../../../app/controller/admin'; +import ExportTest from '../../../app/controller/test'; declare module 'egg' { interface IController { admin: ExportAdmin; + test: ExportTest; } } diff --git a/webpack.config.js b/webpack.config.js index 140a210..d450eb7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,10 +1,12 @@ 'use strict'; const path = require('path'); +const tsImportPluginFactory = require('ts-import-plugin') const resolve = filepath => path.resolve(__dirname, filepath); module.exports = { entry: { - 'admin/login': 'app/web/page/admin/login/login.vue', - 'admin/home': 'app/web/page/admin/home/index.ts' + // 'admin/login': 'app/web/page/admin/login/login.vue', + // 'admin/home': 'app/web/page/admin/home/index.ts', + 'vant': 'app/web/page/vant/index.vue' }, resolve: { alias:{ @@ -21,6 +23,16 @@ module.exports = { { babel: false }, { ts: { + options: { + transpileOnly: true, + getCustomTransformers: () => ({ + before: [ tsImportPluginFactory({ + libraryName: 'vant', + libraryDirectory: 'es', + style: true + })] + }), + }, exclude: [] } } @@ -33,5 +45,8 @@ module.exports = { to: 'asset' }] } - ] + ], + compile: { + thread: false + } }; \ No newline at end of file