1
0
Fork 0
management/front/dkha-web-sz-main/前端笔记.md

49 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

数据的获取:
经常可以看到在`el-form`中调用函数`getDataList()`,但是在源码中找不到函数`getDataList()`。
```vue
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
```
实际上这个函数是在`import mixinViewModule from '@/mixins/view-module'`中被实现,其实现如下:
```javascript
getDataList: function () {
this.page = 1
this.checkList = {};
this.query()
},
```
这里实现的方式似乎相当于对象实例化的方式:
```javascript
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './user-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
// 这里实际上就是getDataList要访问的API
getDataListURL: '/sys/user/page',
getDataListIsPage: true,
deleteURL: '/sys/user',
deleteIsBatch: true,
exportURL: '/sys/user/export'
},
dataForm: {
username: '',
deptId: '',
gender: ''
}
}
},
components: {
AddOrUpdate
}
}
```