Skip to content

How to deselect an item from a list of products when selecting another? Only one can be marked at a time #8239

Discussion options

You must be logged in to vote

Hi @faridsa!

As with almost any problem, there might be several ways to solve it. I believe that a simple way to achieve it is by using the currently selected state that you have inside of your customOrder.js pinia store inside of the FabricModule component with a computed property that checks if itself is the selected fabric.

<script setup>
import { computed } from 'vue';
import { useOrderStore } from '../stores/customOrder.js';

const data = useOrderStore();

// ... All of your logic

// This is no longer needed. Use the isSelected computed property instead
// ❌ const status = reactive({ isSelected: false });

// Computed property that checks if itself is the selected fabric by comparin…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@faridsa
Comment options

@ChrisGV04
Comment options

@faridsa
Comment options

@ChrisGV04
Comment options

Answer selected by faridsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants