Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muazanqureshi's avatar

Create Vue JS Dynamic Variable

hello guys how I will declare a dynamic variable in value such as I have 10 results and I want to declare as showPrice[id] instead of showPrice1,showPrice3,showPrice4 etc

0 likes
3 replies
Sinnbeck's avatar

Hard to help without any context

let id = 22;
let showPrice = {};
showPrice[id] = 'foobar';
muazanqureshi's avatar

@Sinnbeck thing like that showPrice[id]:false in single variable

instead of data() { return { pricingsArray: [], myPricings: [], buildingType: [], searchPricing: '', showPrice1: true, showPrice2: false, } },

Please or to participate in this conversation.