index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import CustomTable from './src/components/TablePage'
  2. import CustomForm from './src/components/Form'
  3. import CustomDialog from './src/components/Dialog'
  4. import CustomSearchForm from './src/components/SearchForm'
  5. import Tools from './src/utils/tool'
  6. import _Vue from 'vue'
  7. const components = [
  8. CustomTable,
  9. CustomForm,
  10. CustomDialog,
  11. CustomSearchForm
  12. ]
  13. const install = function(Vue){
  14. if (!Vue) {
  15. window.Vue = Vue = _Vue
  16. }
  17. components.forEach(function(component){
  18. Vue.component(component.name, component);
  19. });
  20. }
  21. const setDictLoader = function(dictLoad){
  22. Tools.dictLoad = dictLoad
  23. }
  24. const setUploadUrl = function(url){
  25. Tools.upload_stream_url = url
  26. }
  27. const setFormatImgUrl = function(func){
  28. Tools.formatImgUrl = func
  29. }
  30. const setOptions = function(options){
  31. for(var k in options){
  32. Tools[k] = options[k]
  33. }
  34. }
  35. export default {
  36. version: '1.0.0',
  37. CustomTable,
  38. CustomForm,
  39. CustomDialog,
  40. install: install,
  41. setDictLoader: setDictLoader,
  42. setUploadUrl: setUploadUrl,
  43. setFormatImgUrl: setFormatImgUrl,
  44. setOptions: setOptions
  45. }