data-star示例

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="module"
        src="https://cdn.jsdelivr.net/gh/starfederation/datastar@v1.0.0-beta.5/bundles/datastar.js"></script>
    <script type="module" src="https://unpkg.com/marked@15.0.7/marked.min.js"></script>
</head>

<body data-signals="{content: ''}">
    <textarea data-bind-input data-computed-html="marked.parse($input)"
        data-on-input="$content.innerHTML = $html"></textarea>
    <div data-text="$input">
        I will be replaced with the contents of the input signal
    </div>
    <div>
        <div data-text="$html"></div>
        <div data-ref-content></div>
    </div>
</body>

</html>
posted @   卓能文  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示