data-win-bind的正确语法是什么? [英] What's the correct syntax for data-win-bind?

查看:96
本文介绍了data-win-bind的正确语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将哪些内容传递给data-win-bind属性?文档明显不同步。当您查看声明性绑定示例时,这是显而易见的。看来你可以传递一个初始设置绑定方法吗?例如,这里是基本
绑定页面的一些标记:

What can I pass to the data-win-bind attribute? The docs are clearly out of sync. That's obvious when you look at the declarative binding sample. It seems that you can pass it an initial setup binding method? For instance, here's some markup from the basic binding page:

 < p data-win-bind =" style.background:color BasicBinding.toCssColor"> ;

 <p data-win-bind="style.background: color BasicBinding.toCssColor">

  &NBSP; &NBSP; &NBSP;这是你的颜色作为背景。< / p>

        And here's your color as a background.</p>

似乎将style.background初始化为某个对象的颜色属性,然后就是那个方法引用最终构建了程序化绑定(通过调用WinJS.Binding.bind方法)。谁能解释一下这里发生了什么?
我可以传递给data-win-bind属性吗?

It seems like style.background is being initialized to the color property of some object and then there's that method reference which ends up building a programmatic binding (by calling the WinJS.Binding.bind method). Can anyone explain what's going on here? what can I pass to the data-win-bind attribute?

谢谢。

Luis Abreu

Luis Abreu

推荐答案

你好Luis,

Hi Luis,

你需要用正确的CSS样式属性。

You need to use the correct CSS style attibutes.

例如,背景颜色在CSS文件中定义如下:

So for example, background color is defined like this in a CSS file:

   background-color:#ffd800

   background-color: #ffd800

所以你会使用类似的东西:

so you would use something similar to this:

       这是你的背景颜色。< / p>

        And here's your color as a background.</p>

你明白为什么你的定义现在永远不会起作用吗?

Do you understand why your definition would never work now?

-Jeff


这篇关于data-win-bind的正确语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆