如何更新模型中的字段/值?

Ted*_*Guy 2 syntax record elm

如果我的模型看起来像:

type alias Application = { id : Int , term : Int , amount : Int }  
type alias Model = { application : Application }
Run Code Online (Sandbox Code Playgroud)

我正在尝试更新该term值,我onInput UpdateTerm在更新案例语句中的输入上有如何更新此值?

到目前为止,我UpdateTerm term ->;不确定如何只更新term应用程序内部的值?

gle*_*nsl 6

记录字段更新在指南参考文档中都有描述。更新嵌套在另一个记录内的记录中的字段仅是一个接一个地做的事情。假设您有一个名为的绑定model

let
    application =
        model.application

    updatedApplication =
        { application | term = term }
in
{ model | application = updatedApplication }
Run Code Online (Sandbox Code Playgroud)