I have an apartment cost is about 100 a month, how do I survive
- User
I have an apartment cost is about 100 a month, how do I survive
- Assistant
-
Set a budget: First, make a list of your monthly expenses including rent, utilities, groceries, transportation, and other necessities. Subtract your total expenses from your monthly income to determine how much you have left for discretionary spending.
-
Find a roommate: You can cut your rent and utilities bills by finding a reliable roommate to share the costs. Make sure you both sign the rental agreement and communicate your expectations to avoid conflicts.
-
Save on utilities: Conserve energy by turning off lights and electronics when not in use, unplug chargers, using energy-efficient bulbs, and insulating your apartment.
-
- User
use the FinIndicators instead of indicators, so it's more dynamic: import { processEconomy, indicators as FinIndicators} from '@/assets/services/apiEconomy';
import { onMounted, ref, reactive, watchEffect,watch } from 'vue'; import { formatPercentage, formatMoney } from '@/assets/services/util.js'; import gsap from 'gsap';
const props = defineProps({ uuid: Number, title: String, country: String, countryName: String, });
const isLoading = ref(false);
const indicators = reactive([ { name: 'GDP (current US$)', value: null, date: 0, sudoName: 'GDP', type: 'money' }, { name: 'Trade Balance', value: null, date: 0, sudoName: "Trade", type: 'money' }, { name: 'Interest Rate', value: null, date: 0, sudoName: 'Interest', type: 'percent' }, { name: 'Inflation Rate', value: null, date: 0, sudoName: 'Inflation', type: 'percent' }, { name: 'Unemployment Rate', value: null, date: 0, sudoName: "Unemployment", type: 'percent' }, ]);
const tweenedArray = reactive(indicators.map(() => ({ number: 0 })));
watchEffect(async () => { await processEconomy(indicators, props.country, isLoading.value); console.log('data', indicators); for (let index = 0; index < indicators.length; index++) { const { value } = indicators[index]; const numericValue = Number(value); if (!isNaN(numericValue)) { gsap.to(tweenedArray[index], { duration: 0.45, number: numericValue }); } } }, { immediate: true });
- Assistant
This script setup imports necessary functions and Vue components, and initializes reactive properties to display the dynamic economic indicators. Here's an explanation of each part of the code:
-
Import necessary modules: This part imports the
processEconomyfunction andFinIndicatorsobject fromapiEconomy.js, as well as other necessary Vue components and utilities. -
Define properties: This line of code defines the properties that will receive data dynamically from the parent component, such as
uuid,title,country, andcountryName. -
Initialize reactive properties: The
indicatorsandtweenedArrayare both defined as reactive arrays. Theindicatorsarray consists of different economic indicators, with their names, values, date, and types specified. The is used to store the animated values of the indicators.
-