gpt4 book ai didi

sproutcore - 在Sproutcore中自定义html/javascript?

转载 作者:行者123 更新时间:2023-12-03 13:38:44 25 4
gpt4 key购买 nike

是否可以在Sproutcore中使用自定义html/javascript?

我必须使用来自云服务提供商的一些代码。

最佳答案

是的,这很容易。您可以在 View 中定义render()方法:

App.myView = SC.View.extend({

render: function(context, firstTime) {
var someValue = `getValue`

context.push(
"<span class='mySpan'>", someValue, "</span>",
"Any Other html/javascript that you want, can go here."
);

}

})

您还可以使用 firstTime属性来知道您是第一次渲染(输出所有内容)还是只是更新现有代码。

您可以找到更多:
  • http://guides.sproutcore.com/views.html#the-render-and-update-methods
  • http://frozencanuck.wordpress.com/2009/08/14/creating-a-simple-custom-view-in-sproutcore-part1/
  • 关于sproutcore - 在Sproutcore中自定义html/javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4953611/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com