Quintout.js更改图像源点击点击

发布于 2025-02-13 01:54:16 字数 980 浏览 0 评论 0原文

我在代码中有此部分,

<script id="performance-objective-template" type="text/template">
<ul class="node">
    <li class="item-container" data-bind="css: { 'expanded': $data.IsExpanded, 'has-children': $data.Children().length > 0, 'new': $data.Id() == 0 }">
        <span class="arrow"></span>
        <a class="item" data-bind="click: $root.toggleExpanded, css: $root.itemClass($data)">
            <span class="name" data-bind="text: Description"></span>
            <span class="kpi">
                <img width="20" height="20" data-bind="attr: { src: $root.selectionIcon($data) }" />
            </span>
        </a>
        <div class="actions">
        </div>
    </li>
</ul>
</script>

我有两个映像图标供批准和拒绝,并希望每次点击之间翻转它们,并在模型对象上设置属性。 到目前为止,我正在努力修改IMG部分。如果我实现了之类的单击:$ root.changeicon,则该功能永远不会被执行。

我应该如何实现这种行为?

任何帮助都非常感谢。

I am having this section in my code

<script id="performance-objective-template" type="text/template">
<ul class="node">
    <li class="item-container" data-bind="css: { 'expanded': $data.IsExpanded, 'has-children': $data.Children().length > 0, 'new': $data.Id() == 0 }">
        <span class="arrow"></span>
        <a class="item" data-bind="click: $root.toggleExpanded, css: $root.itemClass($data)">
            <span class="name" data-bind="text: Description"></span>
            <span class="kpi">
                <img width="20" height="20" data-bind="attr: { src: $root.selectionIcon($data) }" />
            </span>
        </a>
        <div class="actions">
        </div>
    </li>
</ul>
</script>

I have two image icon for Approved and Rejected and would like to flip between them each click and also set the property on the Model object.
So far I am struggling to modify the img section. If I implement something like click: $root.changeIcon , the function never get executed.

How should I achieve this behavior ?

Any help is much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文