- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个简单的 <input>
radio 用户选择。
<sample>
<ul>
<li each={ techs }>
<input
type='radio'
name='dev_choice'
value={ name }
onclick={ check_choice }>
{ name }
</input>
</li>
</ul>
<button onclick={ check_selection }>Check</button>
<script>
this.message = 'Hello, Riot!'
this.techs = [
{ name: 'HTML', rank: '10' },
{ name: 'JavaScript', rank: '20' },
{ name: 'CSS', rank: '30' }
]
check_choice(e) {
// This is working fine
console.log(e.item.rank)
}
check_selection(e) {
// How do I get the rank of my selected item ??
// None of the below is working
console.log(this.dev_choice)
var choice = $("input[name='dev_choice']:checked")
console.log(choice)
}
</script>
</sample>
RiotJs 似乎将用于创建循环的对象绑定(bind)到 html 对象。但是,我看不到从另一个函数访问此对象的任何方法。欢迎提供任何线索!
更一般地说,如何访问this.techs
来自 $('sample')
?
最佳答案
选择选项时使用 select_tech 变量获取引用。
<sample>
<h2>{ message }</h2>
<ul>
<li each={ techs }>
<input
type='radio'
name='dev_choice'
value={ name }
onclick={ check_choice }>
{ name }
</input>
</li>
</ul>
<button onclick={ check_selection }>Check</button>
<script>
this.message = 'Hello, Riot!'
this.techs = [
{ name: 'HTML', rank: '10' },
{ name: 'JavaScript', rank: '20' },
{ name: 'CSS', rank: '30' }
]
this.selected_tech = {}
check_choice(e) {
this.selected_tech = e.item
}
check_selection(e) {
console.log(this.selected_tech.rank)
}
</script>
</sample>
关于javascript - RiotJs - 如何使用 each={} 访问 RiotJs 绑定(bind)的对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40257207/
我有这个简单的 radio 用户选择。 { name } Check this
父级在传递属性之前进行一些计算 这不起作用。 http://plnkr.co/edit/MguuodHHRlVytnikQKZ7?p=preview 如何实现这一目标? 它是 Web C
我从 Github 下载了 Todo 演示:https://github.com/muut/riotjs/tree/master/demo 但是当我将 index.html 拖到浏览器中时,我什么也看
我正在使用 RiotJS 编写一个表应用程序,但在 onclick 事件上我一直遇到同样的问题。几乎每次我尝试使用 我的行为非常不稳定。有时,它会在页面加载或更新时多次调用该函数,然后根本不响应点击
我正在为系统使用防暴。但我在每个地方都使用公共(public)标签时遇到问题。因为我必须复制每个页面的所有通用标签。 我添加了所有这样的标签。有人对此有解决方案吗?
我有一个附加了 onchange={ MethodName } 的select。如果我手动更改该值,则会触发它。当我调用 $('select#myid').trigger('change') 时,它不
我希望通过在 RiotJS 中的 each={} 循环期间缓存重复值来提高性能和可读性。有没有办法做到这一点,不会渲染该值和/或产生不必要的性能开销? 之前: {item.text}
我刚刚开始学习 riotJS,无法弄清楚标签(实例)之间的通信是如何完成的。我创建了一个简单的例子。假设我有以下标签: { warning_message } th
我无法让我的代码处理异步获取请求。我想加载通过 GET 请求在文件 todo.tag.html 的表中获取的 JSON 对象。我的问题是如何传递参数。我想将参数传递给我的防暴标签,但我不知道如何。我在
我在使用yield和更新标签时遇到问题,请参见示例http://codepen.io/Pysta/pen/pEyoBY { value }
这很奇怪。我做错了什么? class Store extends Riot.Observable { trigger():void { // shouldn't this be comple
我不太确定我是否正确理解了可观察对象的工作方式以及如何从挂载的标签中获取引用。我有一个组件。在这个组件中,我们有一个 组件 和一个 组件。目的是避免组件之间的耦合。因此,我希望我的搜索组件 在搜索完成
从这个工作元素开始,sans-js:http://jsfiddle.net/37z1z7g1/
我似乎无法弄清楚如何将变量传递到自定义元素的类、ID 或数据属性中。 opts.status、opts.id 和 opts.url 如果我在像 这样的元素中传递它们,它们都可以工作,但是如何将变量
我正在尝试使用加载标签的概念,我可以包装其他元素以在异步检索数据时提供一致的加载显示。考虑以下代码: This example relies on browserify (require) but s
不得不说,为 Typescript 设置环境是费力且充满挫败感的。无论如何,这都不是一项直接的任务。 无论如何: I am still trying to setup riot-ts with JSP
我正在尝试向现有标记添加一个方法,单击按钮时调用该方法,但在开发构建时出现此错误。 https://github.com/wbkd/riotjs-startkit ./src/components/i
我是一名优秀的程序员,十分优秀!