我正在尝试使用嵌套分配,但找不到更新其值的方法......想象一下我有这个:
def mount(socket) do
socket = assign(socket, state: [value1: "20", value2: "50"])
{:ok, socket}
end
如何在此处更新值?
def handle_event("dec", _params, socket) do
socket = assign(socket, state[:value1], "1")
{:noreply, socket}
end
如何引用/表示该嵌套键?