You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
3.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
  1. import Vue from 'vue';
  2. import Element from 'element-ui';
  3. Vue.use(Element, {size: 'small', zIndex: 1000});
  4. import {
  5. Pagination,
  6. Dialog,
  7. Autocomplete,
  8. Dropdown,
  9. DropdownMenu,
  10. DropdownItem,
  11. Menu,
  12. Submenu,
  13. MenuItem,
  14. MenuItemGroup,
  15. Input,
  16. InputNumber,
  17. Radio,
  18. RadioGroup,
  19. RadioButton,
  20. Checkbox,
  21. CheckboxButton,
  22. CheckboxGroup,
  23. Switch,
  24. Select,
  25. Option,
  26. OptionGroup,
  27. Button,
  28. ButtonGroup,
  29. Table,
  30. TableColumn,
  31. DatePicker,
  32. TimeSelect,
  33. TimePicker,
  34. Popover,
  35. Tooltip,
  36. Breadcrumb,
  37. BreadcrumbItem,
  38. Form,
  39. FormItem,
  40. Tabs,
  41. TabPane,
  42. Tag,
  43. Tree,
  44. Alert,
  45. Slider,
  46. Icon,
  47. Row,
  48. Col,
  49. Upload,
  50. Progress,
  51. Badge,
  52. Card,
  53. Rate,
  54. Steps,
  55. Step,
  56. Carousel,
  57. CarouselItem,
  58. Collapse,
  59. CollapseItem,
  60. Cascader,
  61. ColorPicker,
  62. Transfer,
  63. Container,
  64. Header,
  65. Aside,
  66. Main,
  67. Drawer,
  68. Footer,
  69. Loading,
  70. MessageBox,
  71. Message,
  72. Notification
  73. } from 'element-ui';
  74. Vue.use(Drawer);
  75. Vue.use(Pagination);
  76. Vue.use(Dialog);
  77. Vue.use(Autocomplete);
  78. Vue.use(Dropdown);
  79. Vue.use(DropdownMenu);
  80. Vue.use(DropdownItem);
  81. Vue.use(Menu);
  82. Vue.use(Submenu);
  83. Vue.use(MenuItem);
  84. Vue.use(MenuItemGroup);
  85. Vue.use(Input);
  86. Vue.use(InputNumber);
  87. Vue.use(Radio);
  88. Vue.use(RadioGroup);
  89. Vue.use(RadioButton);
  90. Vue.use(Checkbox);
  91. Vue.use(CheckboxButton);
  92. Vue.use(CheckboxGroup);
  93. Vue.use(Switch);
  94. Vue.use(Select);
  95. Vue.use(Option);
  96. Vue.use(OptionGroup);
  97. Vue.use(Button);
  98. Vue.use(ButtonGroup);
  99. Vue.use(Table);
  100. Vue.use(TableColumn);
  101. Vue.use(DatePicker);
  102. Vue.use(TimeSelect);
  103. Vue.use(TimePicker);
  104. Vue.use(Popover);
  105. Vue.use(Tooltip);
  106. Vue.use(Breadcrumb);
  107. Vue.use(BreadcrumbItem);
  108. Vue.use(Form);
  109. Vue.use(FormItem);
  110. Vue.use(Tabs);
  111. Vue.use(TabPane);
  112. Vue.use(Tag);
  113. Vue.use(Tree);
  114. Vue.use(Alert);
  115. Vue.use(Slider);
  116. Vue.use(Icon);
  117. Vue.use(Row);
  118. Vue.use(Col);
  119. Vue.use(Upload);
  120. Vue.use(Progress);
  121. Vue.use(Badge);
  122. Vue.use(Card);
  123. Vue.use(Rate);
  124. Vue.use(Steps);
  125. Vue.use(Step);
  126. Vue.use(Carousel);
  127. Vue.use(CarouselItem);
  128. Vue.use(Collapse);
  129. Vue.use(CollapseItem);
  130. Vue.use(Cascader);
  131. Vue.use(ColorPicker);
  132. Vue.use(Container);
  133. Vue.use(Header);
  134. Vue.use(Aside);
  135. Vue.use(Main);
  136. Vue.use(Footer);
  137. Vue.use(Loading.directive);
  138. Vue.prototype.$loading = Loading.service;
  139. Vue.prototype.$msgbox = MessageBox;
  140. Vue.prototype.$alert = MessageBox.alert;
  141. Vue.prototype.$confirm = MessageBox.confirm;
  142. Vue.prototype.$prompt = MessageBox.prompt;
  143. Vue.prototype.$notify = Notification;
  144. Vue.prototype.$message = Message;
  145. Vue.prototype.$ELEMENT = {size: 'medium'}
  146. Vue.prototype.$message = function (msg) {
  147. let msgObj = {
  148. message: msg.message ? msg.message : msg,
  149. duration: msg.duration || 2000
  150. }
  151. let msgType = msg.type || ""
  152. switch (msgType) {
  153. case 'success':
  154. return Message.success(msgObj);
  155. break;
  156. case 'warning':
  157. return Message.warning(msgObj);
  158. break;
  159. case 'error':
  160. return Message.error(msgObj);
  161. break;
  162. default:
  163. return Message(msgObj);
  164. }
  165. }
  166. Vue.prototype.$message.success = function (msg) {
  167. return Message.success({
  168. message: msg,
  169. duration: 1000
  170. })
  171. }
  172. Vue.prototype.$message.warning = function (msg) {
  173. return Message.warning({
  174. message: msg,
  175. duration: 1000
  176. })
  177. }
  178. Vue.prototype.$message.error = function (msg) {
  179. return Message.error({
  180. message: msg,
  181. duration: 1500
  182. })
  183. }