大家好,我是小鱼,这也是我的笔记,这是我的原创,学习可以,未经同意,禁止随意转载!
进入整体,我们看代码
<input type="radio" bind:group={tortilla} value="Plain">
<script>
let tortilla = 'Plain';
let fillings = [];
</script>
官网其实就提供这么一个东西,我来扩展一下东西主要是
扩展啥呢,第一就是下标,如何取这么下标或者能取到什么东西得到哪些属性,以及注意事项!
按照官网的说法,这个叫做姐绑定
多个input值可以使用bind:group
进行绑定。
比如说吧
<input type="checkbox" bind:group={tortila} value="Rice" on:click={hanlek} checked="true">
这是取下标的
js地区就是需要
function hanlek(e){
console.log(e.target.checked)
}
我们就需要通过用e拿这个状态值
判断true或者false,另外还有一些事情就是
关于input
<input bind:group={tortila} value="Rice" on:click={hanlek} checked="true"> 错误
别把类型忘记了
官网说了,支持多个属性进行绑定
<input type="checkbox" bind:group={tortila} value="Rice" on:click={hanlek} checked="true">
<input type="checkbox" bind:group={tortila} value="Rice" on:click={hanlek} checked="true">
<input type="checkbox" bind:group={tortila} value="Rice" on:click={hanlek} checked="true">
<input type="checkbox" bind:group={tortila} value="Rice" on:click={hanlek} checked="true">
其实这是对的,不过具体怎么玩,涉及到状态也就是e了,后台管理权限应该用到的更多
好了,今天就说到了这里了,拜了大家!