n20-common-lib 2.5.0-beta.7 → 2.5.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.5.0-beta.7",
3
+ "version": "2.5.0-beta.8",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -554,9 +554,12 @@ export default {
554
554
  MultipleSUccessFn(response, file, fileList, row) {
555
555
  if (fileList.length > 1) {
556
556
  let deepRow = cloneDeep(row)
557
- if (!this.tableData[0][this.keys.url]) {
558
- this.tableData.shift()
559
- }
557
+ this.$nextTick(() => {
558
+ if (this.tableData.length && !this.tableData[0][this.keys.url]) {
559
+ this.tableData.shift()
560
+ }
561
+ })
562
+
560
563
  setTimeout(() => {
561
564
  this.tableData.splice(0, 0, {
562
565
  _name: file.name,
@@ -0,0 +1,22 @@
1
+ const directive = {}
2
+
3
+ directive.install = (Vue) => {
4
+ Vue.directive('toErrorMessage', {
5
+ bind: () => {
6
+ document.body.addEventListener('click', () => {
7
+ // 获取el-form元素
8
+ var form = document.querySelector('.el-form')
9
+ // 检查是否有必填项校验错误
10
+ var errorElement = form.querySelector('.is-error')
11
+ if (errorElement) {
12
+ // 获取第一个必填项所在的位置
13
+ var errorOffset = errorElement.offsetTop
14
+ // 滚动到必填项位置
15
+ window.scrollTo(0, errorOffset)
16
+ }
17
+ })
18
+ }
19
+ })
20
+ }
21
+
22
+ export default directive
package/src/index.js CHANGED
@@ -97,6 +97,7 @@ import VMove from './directives/VMove/index.js'
97
97
  import VRuleKey from './directives/VRuleKey/index.js'
98
98
  import { HoverTooltip, TitleDirective } from './directives/VTitle/index.js'
99
99
  import VTableLoading from './directives/loading/index.js'
100
+ import VErrorMessage from './directives/VErrorMessage/index.js'
100
101
 
101
102
  /** 注入方法 */
102
103
  import dayjs from 'dayjs'
@@ -227,6 +228,7 @@ const install = function (Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
227
228
  Vue.use(VClickOutside)
228
229
  Vue.use(VHas)
229
230
  Vue.use(VTableLoading)
231
+ Vue.use(VErrorMessage)
230
232
 
231
233
  Vue.use(i18n, opts.i18nConfig)
232
234
  Vue.prototype.$axios = axios