Skip to content

Commit

Permalink
feat: vant #17
Browse files Browse the repository at this point in the history
  • Loading branch information
sky committed Jul 21, 2020
1 parent 4c162dd commit 26ee194
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 5 deletions.
8 changes: 8 additions & 0 deletions app/controller/test.ts
Original file line number Diff line number Diff line change
@@ -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', {});
}
}
1 change: 1 addition & 0 deletions app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
15 changes: 15 additions & 0 deletions app/web/page/vant/index.ts
Original file line number Diff line number Diff line change
@@ -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 {

}
8 changes: 8 additions & 0 deletions app/web/page/vant/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<Layout>
<h1>123456</h1>
<Button>Vant Button</Button>
</Layout>
</template>

<script lang="ts" src="./index.ts"></script>
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions typings/app/controller/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
21 changes: 18 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -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:{
Expand All @@ -21,6 +23,16 @@ module.exports = {
{ babel: false },
{
ts: {
options: {
transpileOnly: true,
getCustomTransformers: () => ({
before: [ tsImportPluginFactory({
libraryName: 'vant',
libraryDirectory: 'es',
style: true
})]
}),
},
exclude: []
}
}
Expand All @@ -33,5 +45,8 @@ module.exports = {
to: 'asset'
}]
}
]
],
compile: {
thread: false
}
};

0 comments on commit 26ee194

Please sign in to comment.