plm前端
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.

196 lines
3.2 KiB

2 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. Footer,
  68. Loading,
  69. MessageBox,
  70. Message,
  71. Notification
  72. } from 'element-ui';
  73. Vue.use(Pagination);
  74. Vue.use(Dialog);
  75. Vue.use(Autocomplete);
  76. Vue.use(Dropdown);
  77. Vue.use(DropdownMenu);
  78. Vue.use(DropdownItem);
  79. Vue.use(Menu);
  80. Vue.use(Submenu);
  81. Vue.use(MenuItem);
  82. Vue.use(MenuItemGroup);
  83. Vue.use(Input);
  84. Vue.use(InputNumber);
  85. Vue.use(Radio);
  86. Vue.use(RadioGroup);
  87. Vue.use(RadioButton);
  88. Vue.use(Checkbox);
  89. Vue.use(CheckboxButton);
  90. Vue.use(CheckboxGroup);
  91. Vue.use(Switch);
  92. Vue.use(Select);
  93. Vue.use(Option);
  94. Vue.use(OptionGroup);
  95. Vue.use(Button);
  96. Vue.use(ButtonGroup);
  97. Vue.use(Table);
  98. Vue.use(TableColumn);
  99. Vue.use(DatePicker);
  100. Vue.use(TimeSelect);
  101. Vue.use(TimePicker);
  102. Vue.use(Popover);
  103. Vue.use(Tooltip);
  104. Vue.use(Breadcrumb);
  105. Vue.use(BreadcrumbItem);
  106. Vue.use(Form);
  107. Vue.use(FormItem);
  108. Vue.use(Tabs);
  109. Vue.use(TabPane);
  110. Vue.use(Tag);
  111. Vue.use(Tree);
  112. Vue.use(Alert);
  113. Vue.use(Slider);
  114. Vue.use(Icon);
  115. Vue.use(Row);
  116. Vue.use(Col);
  117. Vue.use(Upload);
  118. Vue.use(Progress);
  119. Vue.use(Badge);
  120. Vue.use(Card);
  121. Vue.use(Rate);
  122. Vue.use(Steps);
  123. Vue.use(Step);
  124. Vue.use(Carousel);
  125. Vue.use(CarouselItem);
  126. Vue.use(Collapse);
  127. Vue.use(CollapseItem);
  128. Vue.use(Cascader);
  129. Vue.use(ColorPicker);
  130. Vue.use(Container);
  131. Vue.use(Header);
  132. Vue.use(Aside);
  133. Vue.use(Main);
  134. Vue.use(Footer);
  135. Vue.use(Loading.directive);
  136. Vue.prototype.$loading = Loading.service;
  137. Vue.prototype.$msgbox = MessageBox;
  138. Vue.prototype.$alert = MessageBox.alert;
  139. Vue.prototype.$confirm = MessageBox.confirm;
  140. Vue.prototype.$prompt = MessageBox.prompt;
  141. Vue.prototype.$notify = Notification;
  142. Vue.prototype.$message = Message;
  143. Vue.prototype.$ELEMENT = {size: 'medium'}
  144. Vue.prototype.$message = function (msg) {
  145. let msgObj = {
  146. message: msg.message ? msg.message : msg,
  147. duration: 2000
  148. }
  149. let msgType = msg.type || ""
  150. switch (msgType) {
  151. case 'success':
  152. return Message.success(msgObj);
  153. break;
  154. case 'warning':
  155. return Message.warning(msgObj);
  156. break;
  157. case 'error':
  158. return Message.error(msgObj);
  159. break;
  160. default:
  161. return Message(msgObj);
  162. }
  163. }
  164. Vue.prototype.$message.success = function (msg) {
  165. return Message.success({
  166. message: msg,
  167. duration: 1000
  168. })
  169. }
  170. Vue.prototype.$message.warning = function (msg) {
  171. return Message.warning({
  172. message: msg,
  173. duration: 1000
  174. })
  175. }
  176. Vue.prototype.$message.error = function (msg) {
  177. return Message.error({
  178. message: msg,
  179. duration: 1500
  180. })
  181. }