Git Product home page Git Product logo

Comments (12)

airyland avatar airyland commented on August 28, 2024 1

剥离数据在开发计划中,但是要求参数格式和目前的统一。

from vux.

sandysong avatar sandysong commented on August 28, 2024 1

异步取数据写在data钩子里,然后为组件加上v-if="!$loadingRouteData"解决了

from vux.

sandysong avatar sandysong commented on August 28, 2024

试了一下,虽然可以通过list传数据进去,但是父组件是异步从server端取list的,初始化的时候会报错:
Uncaught TypeError: Cannot read property 'value' of undefined
Uncaught TypeError: Cannot read property 'name' of undefined

from vux.

airyland avatar airyland commented on August 28, 2024

传进去是数据还是空的?

from vux.

sandysong avatar sandysong commented on August 28, 2024

我是在父组件的created钩子里异步从server端加载数据,然后设置到父组件的data.list里,address组件的list和父组件data.list绑定。这样用对么?

from vux.

airyland avatar airyland commented on August 28, 2024

这样的话,address组件一开始会没有数据,初始化失败。如果你用vue-router的话,可以使用 data 钩子来在compile组件前进行数据获取

http://vuejs.github.io/vue-router/zh-cn/pipeline/data.html

我也在考虑支持异步设置 list 和 value,但是可能出现用户操作时list还没有获取成功的情况

from vux.

sandysong avatar sandysong commented on August 28, 2024

data钩子估计也不行,异步请求最终都一样

from vux.

airyland avatar airyland commented on August 28, 2024

这样子能保证在组件初始化前数据已经获取到了。

from vux.

sandysong avatar sandysong commented on August 28, 2024

我知道了,我尝试一下

from vux.

sandysong avatar sandysong commented on August 28, 2024

试了一下,貌似在data钩子调用前就js报错了

from vux.

airyland avatar airyland commented on August 28, 2024

添加 waitForData: true 呢

from vux.

airyland avatar airyland commented on August 28, 2024

@sandysong 👍 这种思路不错。

from vux.

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.