fix: check all gangguan menu
This commit is contained in:
@@ -3,13 +3,19 @@
|
||||
<fieldset>
|
||||
<div class="space-y-3 sm:flex sm:items-center sm:space-y-0 sm:space-x-5">
|
||||
<div v-for="item in radioItems" :key="item.id" class="flex items-center">
|
||||
<input v-model="groupValue"
|
||||
type="radio" name="radio"
|
||||
<input
|
||||
v-model="groupValue"
|
||||
type="radio"
|
||||
name="radio"
|
||||
:checked="itemSelected.id === item.id ? true : false"
|
||||
@change="onChange(item)"
|
||||
class="w-4 h-4 border-gray-300 text-primary-500 peer focus:ring-primary-500" />
|
||||
<label :for="`${item.id}`" class="block ml-3 text-sm font-medium text-gray-700 peer-checked:text-primary-500">{{
|
||||
item.title }}</label>
|
||||
class="w-4 h-4 border-gray-300 text-primary-500 peer focus:ring-primary-500"
|
||||
/>
|
||||
<label
|
||||
:for="`${item.id}`"
|
||||
class="block ml-3 text-sm font-medium text-gray-700 peer-checked:text-primary-500"
|
||||
>{{ item.title }}</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -17,16 +23,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, type PropType, onMounted } from 'vue'
|
||||
import { ref, type PropType, onMounted } from 'vue'
|
||||
|
||||
interface Item {
|
||||
id: number;
|
||||
title: string;
|
||||
checked?: boolean;
|
||||
id: number
|
||||
title: string
|
||||
checked?: boolean
|
||||
}
|
||||
|
||||
const onChange= (e:Item) => {
|
||||
const onChange = (e: Item) => {
|
||||
itemSelected.value = e
|
||||
console.log(e)
|
||||
emit('update:groupValue', e)
|
||||
}
|
||||
|
||||
@@ -44,5 +51,4 @@ const groupValue = ref(1)
|
||||
onMounted(() => {
|
||||
itemSelected.value = props.radioItems[0]
|
||||
})
|
||||
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user