Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type=date时间范围选择v-model失效 #103

Open
ashuicoder opened this issue Jan 27, 2021 · 2 comments
Open

type=date时间范围选择v-model失效 #103

ashuicoder opened this issue Jan 27, 2021 · 2 comments

Comments

@ashuicoder
Copy link

Bug report(问题描述)

Steps to reproduce(问题复现步骤)

        registerTime: {
          type: 'date',
          label: '注册时间',
          attrs: {
            type: 'daterange',
            'start-placeholder': '开始日期',
            'end-placeholder': '结束日期'
          }
        }

Screenshot or Gif(截图或动态图)

QQ录屏20210127100209

Link to minimal reproduction(最小可在线还原demo)

Other relevant information(格外信息)

  • Vue version:
  • ElementUI version:
  • vue-ele-form version:
@ashuicoder
Copy link
Author

获取到的值是NaN

@ashuicoder
Copy link
Author

已找到解决办法

        registerTime: {
          type: 'date',
          label: '注册时间',
          attrs: {
            type: 'daterange',
            format: 'yyyy-MM-dd',
            'unlink-panels': true,
            'start-placeholder': '开始日期',
            'end-placeholder': '结束日期',
            'value-format': 'yyyy-MM-dd'
          },
          displayFormatter: value => {
            if (Array.isArray(value)) {
              return value.join(',')
            } else {
              return ''
            }
          }
        }

但是治标不治本,看了element v-model绑定的是一个数组,元素是两个Date,但是ele-form只接受Numer、String、Date,就会导致处理不正确

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant