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

在首次加载表格时,怎样才能默认它是通过search()方法去加载的 #147

Open
little-eight-china opened this issue Jun 25, 2019 · 6 comments
Labels
good first issue Good for newcomers has answer this issue has answer to solve this problem

Comments

@little-eight-china
Copy link

我写的自定义操作都在beforeSearch中,所以初始化表格的时候,必须要执行beforeSearch

目前的话,好像只是通过url是否变化而初始化表格

@little-eight-china
Copy link
Author

这里的 getList 改成search是否更合理呢

watch: {
    url: function(val, old) {
      this.page = defaultFirstPage
      this.getList()
    },

@donaldshen
Copy link
Contributor

你可以在初始化阶段先将url设为'',然后执行你的自定义操作,最后在设url为实际值

@little-eight-china
Copy link
Author

@donaldshen
设置 url为 '’ ,不就会报DataTable: url 为空, 不发送请求的错误了么

@donaldshen
Copy link
Contributor

@donaldshen
设置 url为 '’ ,不就会报DataTable: url 为空, 不发送请求的错误了么

只能说这确实不够鲁棒,先凑合用吧……

@levy9527
Copy link
Contributor

你好,你提的到这个,的确是有场景的,后续想办法满足

@levy9527 levy9527 added the good first issue Good for newcomers label Jun 26, 2019
@levy9527
Copy link
Contributor

levy9527 commented Jul 1, 2019

你好,是否有代码示例。目前不改代码的话,能想到的是两种方案:

  1. 页面跳转的时候query传参,这样table的查询会带上query的参数
  2. mounted后,通过ref操作table里的form-renderer,然后updateForm,把搜索内容补充上去。这样起码可以做到,用户点击“查询”时,已经有默认的搜索条件了

@levy9527 levy9527 added the has answer this issue has answer to solve this problem label Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers has answer this issue has answer to solve this problem
Projects
None yet
Development

No branches or pull requests

3 participants