coldbox-modules / cbwire

CBWIRE is a ColdBox module that makes building reactive, modern apps easy using HTML-over-the-wire technologies and CFML.
https://cbwire.ortusbooks.com
Other
28 stars 5 forks source link

Add Inline Components #104

Closed grantcopley closed 1 year ago

grantcopley commented 1 year ago
<cfscript>
    // @Wire
    data = {
        "counter": 0
    };

    computed = {
        "isEven": function() {
            return data.counter % 2 == 0 ? true : false;
        }
    }

    function increment() {
        data.counter += 1;
    }
    // @EndWire
</cfscript>

<cfoutput>
    <div>
        InlineWire
        <div>
            Counter: #args.counter#
        </div>
        <div>
            Is even: #args.computed.isEven()#
        </div>
        <div>
            <button wire:click="increment">Increment</button>
        </div>
    </div>
</cfoutput>