Giter Site home page Giter Site logo

Comments (8)

otakustay avatar otakustay commented on June 21, 2024

假设通过getSearchQuery拿到的参数和URL比较少了foo,基类恐怕没办法知道是因为foo这个查询条件的控件没有值(没有foo正常),还是因为foo是个查询无关的参数(要把foo加回去)

所以基类可能无能为力

from ub-ria.

otakustay avatar otakustay commented on June 21, 2024

考虑下在purify前就和url参数做比对也许行,关键是:是否在url里且不在控件提供的值里的东西,一定都是要保留的

from ub-ria.

bobshen avatar bobshen commented on June 21, 2024

因为foo这个查询条件的控件没有值(没有foo正常),还是因为foo是个查询无关的参数

如果不存在 foo 这个查询控件,那么进入 reloadWithQueryUpdate 时,args 中便没有这个属性,把 URL中的 foo 补回去很好理解;
如果存在 foo 这个查询控件,那么进入 reloadWithQueryUpdate 时,argsfoo 这个属性,但是value是'',那么这个作为优先级比较高的参数,覆盖 URL 和 defaultArgs 中的同名属性也是可以的

from ub-ria.

otakustay avatar otakustay commented on June 21, 2024

所以用purify(merge(url.query, searchArgs))这个逻辑对吧,如果靠谱的话可以考虑这么来

Shen Bin [email protected]于2016年7月11日 周一下午9:21写道:

因为foo这个查询条件的控件没有值(没有foo正常),还是因为foo是个查询无关的参数

如果不存在 foo 这个查询控件,那么进入 reloadWithQueryUpdate 时,args 中便没有这个属性,把 URL中的 foo
补回去很好理解;
如果存在 foo 这个查询控件,那么进入 reloadWithQueryUpdate 时,args 有 foo
这个属性,但是value是'',那么这个作为优先级比较高的参数,覆盖 URL 和 defaultArgs 中的同名属性也是可以的


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#266 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAnCPSP4q3orgGzszpBPpi-79aV_THF5ks5qUkNvgaJpZM4JJVda
.

from ub-ria.

bobshen avatar bobshen commented on June 21, 2024

所以用purify(merge(url.query, searchArgs))这个逻辑对吧,如果靠谱的话可以考虑这么来

是的,u.purify(args, {...defaultArgs, ...this.context.url.getQuery()}) 我想的是改成这样。

关键是:是否在url里且不在控件提供的值里的东西,一定都是要保留的

关于这点,其实我也在思考。或者问题可以改为:什么情况下出现在url中且不在查询参数中的参数,在页面reload时不应该保留?

from ub-ria.

otakustay avatar otakustay commented on June 21, 2024

你这个逻辑完全没保留url中的参数吧。。。purify的第二个参数是参考值,不会加到结果里去的

看PR吧

from ub-ria.

bobshen avatar bobshen commented on June 21, 2024

嗯,之前示例的是有问题... 没想到 purify 的defaults 参数,不是类似 u.defaults 的作用。

from ub-ria.

bobshen avatar bobshen commented on June 21, 2024

那这个issue可以close了

from ub-ria.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.