Engee 文档

StippleMathjs

StippleMathjs 将 mathjs 添加到您的 StippleGenieFramwork 项目中。

此外,它还能在服务器和客户端之间自动转换所有类型的`Complex` 数字。

应用程序示例

using Stipple, Stipple.ReactiveTools
using StippleUI
using StippleMathjs


x0 = 1.0
y0 = 2.0

@app begin
    @in x = x0
    @in y = y0
    @in z = x0 + y0 * im
    @in z2::ComplexF64 = x0 + y0 * im

    @onchange x, y begin
        # update z without triggering `@onchange z`
        z[!] = x + y * im

        # update x and y of the client(s)
        @push z
    end

    @onchange z begin
        # update x and y without triggering `@onchange x, y`
        x[!] = z.re
        y[!] = z.im

        # update x and y of the client(s)
        @push x
        @push y
    end
end

@deps StippleMathjs

function ui()
    [
        card(class = "q-pa-md", [
            numberfield(class = "q-ma-md", "x", :x)
            numberfield(class = "q-ma-md", "y", :y)
        ])

        card(class = "q-pa-md q-my-md", [
            row([cell(col = 2, "z"),        cell("{{ z }}")])
            row([cell(col = 2, "z.mul(z)"), cell("{{ z.mul(z) }}")])
            row([cell(col = 2, "z.abs()"),  cell("{{ z.abs() }}")])

            btn(class = "q-my-md", "square(z)", color = "primary", @click("z = z.mul(z)"))
        ])
    ]
end

@page("/", ui, debounce = 10)
up()

带有正确 Manifest.toml 的示例应用程序可从 StippleDemos.jl 上获取。

注意

  • 由于 Stipple 目前的一个错误,您需要在循环外定义`x0` 和`y0` ,以确保 z 的类型正确。

或者,您也可以明确地声明`z` ,如`z::ComplexF64`

  • 这个软件包可以作为一个很好的例子,说明如何在自己的项目中嵌入其他 javascript 源。