Giter Site home page Giter Site logo

Comments (4)

2betop avatar 2betop commented on April 25, 2024

包含关系?

from amis.

SnailSword avatar SnailSword commented on April 25, 2024

包含关系?

包含关系和并列关系,我都想知道怎么传比较好。

比如form中有几个item依赖同一个api
本来想的是用service包一下这几个item,但是发现这样的话,这几个item的数据没法给到外层form中。
感觉service会阻止数据像上层传递?
然后只能写成:

const nestApi = (apiArray, main) => {
    let result = main;
    apiArray.forEach(api => {
        result = {
            type: 'service',
            api,
            body: result,
            name: api.name
        }
    });
    return result;
}

// 把所有的依赖的api都套在最外层
… 
body: [
         nestApi([nlpGetDeatilApi, initWithDataApi, nlpGetConfApi, clusterApiFromJobId], getMainForm(opt))
 ],
…

感觉这么写虽然实现功能了,但是太ugly了,想请教一下正常应该咋把service里面包的数据和外层的数据绑定,以便实现类似外层form提交时候,可以正常校验和提交service里面包住的部分这样的功能。

from amis.

2betop avatar 2betop commented on April 25, 2024

你可能用错了,service 底下要用 controls 而不是用 body 包东西。

https://baidu.github.io/amis/linkpage/form2

from amis.

SnailSword avatar SnailSword commented on April 25, 2024

你可能用错了,service 底下要用 controls 而不是用 body 包东西。

image

... ... 啊 原来这样啊 谢谢

from amis.

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.