Skip to content

Commit

Permalink
perf: 优化调试逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Dec 7, 2020
1 parent 4023818 commit 30d8c1d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 15 deletions.
52 changes: 42 additions & 10 deletions examples/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,62 @@
-->
<template>
<div id="app">

<TableDesignerDialog ref="table"></TableDesignerDialog>
<FormDesignerDialog ref="form"></FormDesignerDialog>
<CrudTable tableName='dept'
:visibleList='{
tableTitle:false,
}'
fullHeight>
<CrudTable
tableName="users"
orderCondition="timestamp desc"
:visibleList="{
tableTitle: false,
}"
:actionColumnWidth="300"
:remoteFuncs="remoteFuncs"
fullHeight
>
</CrudTable>
<el-button @click="showDialog('form')"
type="primary">打开表单设计器</el-button>
<el-button @click="showDialog('table')"
type="danger">打开表格设计器</el-button>
<el-button @click="showDialog('form')" type="primary"
>打开表单设计器</el-button
>
<el-button @click="showDialog('table')" type="danger"
>打开表格设计器</el-button
>
</div>
</template>

<script>
import { DML, crud } from '@/api/public/crud';

export default {
name: 'app',
methods: {
showDialog(name) {
this.$refs[name].showDialog();
},
},
data() {
return {

remoteFuncs: {
// 请求角色
funcGetRole(resolve) {
crud(DML.SELECT, 'role').then((res) => {
const options = res.data.list.map(item => ({
label: item.roleName,
value: item.id,
}));
resolve(options);
});
},
// 请求部门tree
funcGetDeptTree: (resolve) => {
// 此处暂时写死 admin权限的账号可以看到全部部门
crud(DML.TREE, 'dept').then((res) => {
resolve(res.data);
});
},
},
};
},
};
</script>

Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion public/index.html → examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>npmplugin</title>
<title>element-pro-crud</title>
<script>window.__HOST__URL__ = 'http://localhost:7788';</script>
<script>window.__PREFIX__URL__ = '/';</script>
</head>
<body>
<noscript>
Expand Down
17 changes: 14 additions & 3 deletions examples/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ import App from './App.vue';
import plugin from '../src/index';
// 引入ElementUI
import './element';
import axios from '../src/api/axios';

Vue.use(plugin);
Vue.config.productionTip = false;

new Vue({
render: h => h(App),
}).$mount('#app');
axios({
url: '/users/login',
method: 'post',
data: {
password: '123',
username: 'admin',
},
}).then((res) => {
sessionStorage.setItem('token', res.data.token);
new Vue({
render: h => h(App),
}).$mount('#app');
});
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
// page 的入口
entry: 'examples/main.ts',
// 模板来源
template: 'public/index.html',
template: 'examples/index.html',
// 输出文件名
filename: 'index.html',
},
Expand Down

0 comments on commit 30d8c1d

Please sign in to comment.