Is there a way to automatically update object property values when local storage values change?

I need to update the bt.name_en, bt.text_en, and bt.date_en whenever the LocalStorage value changes (

const local = localStorage.getItem("inLan");
).

If the value of

const local (const local = localStorage.getItem("inLan");
is equal to name_jp, then the name, text, and date should be updated to "JP" (bt.name_jp, bt.text_jp, and bt.date_jp). How can I achieve this in an efficient and accurate manner?

<template>
  <div class="about">
    <Header />
      <div class="line">
        <ul>
          <li v-for="bt in list" :key="bt.id">
            <div class="line-cont">
              <h2 class="dateX" >{{ bt.date_en }}</h2>
              <h1>{{ bt.name_en }}</h1>
              <p>{{ bt.text_en }}</p>
              <div class="divm">
                <img class="img" :src="bt.image" alt="">
              </div>
            </div>
          </li>
        </ul>
      </div>
    <Footer />
  </div>
</template>

<script>
import { computed } from "vue";
import { l } from "@/modules/languages";
import useAb from "@/modules/About";
import Header from "@/components/Header.vue";
import Footer from "@/components/Footer.vue";

export default {
  name: "About",
  components: {
    Header,
    Footer,
  },
  setup() {
    const cards = useAb();
    const list = computed(() => cards.state.abouts);
    const local = localStorage.getItem("inLan");

    return {
      l,
      list,
      local,
    };
  },
};
</script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process for implementing my code to utilize Ctrl+A for selecting all?

Is there a way to implement the Ctrl+A keyboard shortcut for selecting all text in an input field? Visit this link for reference. To apply the functionality, enter a number like EG: 333.44 into the input field and then press Ctrl+A. If all data in the i ...

Implementing nth-child selector in vanilla JavaScript

Is there a way to dynamically change the number within the nth-child brackets when clicking on a button? For instance, can I click a button and have the next slide in a slideshow appear? .slideshow:nth-child(n){} I specifically need to modify n using only ...

Automatically set focus to the first row in an ng-grid using code

Within my project, there is a specific requirement to ensure that the focus is on the first row of the ng-grid upon grid load. Furthermore, this focus should shift to the next row when the down key is pressed. To accomplish this, I implemented the followin ...

Moving the grid in threejs when the camera approaches its edge: A guide

Is there a way to create an infinite grid plane without having to generate a massive grid each time? I attempted adjusting camera.position.z and grid.position.z, but the grid's z position remains at 0 when moving the camera. Looking for functionalit ...

What is the process for including and removing columns in a document or data table?

I'm interested in implementing vue ag-grid for my project. To get started, I checked out the Get Started with ag-Grid in Your Vue Project article. However, I couldn't find any examples on how to add a delete column as a link-button? <a :cli ...

Creating a moving average calculation using a circular buffer array

I'm currently working on incorporating a circular buffer to calculate the average of a data stream produced by a pressure sensor in C, executed on an embedded controller. The plan is to store the most recent N pressure readings in the buffer while kee ...

Loading a local CSS file upon opening a tab with a specific URL

When opening a tab to load a local HTML file from an addon (using addon-sdk), the following code is used: tabs.open({ url: self.data.url('index.html'), onReady: myScript }); However, there seems to be no straightforward way to include a CSS ...

"npm is the go-to tool for managing client-side JavaScript code

As I delved into a document outlining the npm Developer Guide, a question sprang to mind. Is it within the realm of possibility to construct a web client application using javascript/css/html with npm at the helm? And if so, might there be examples avail ...

Using AJAX to dynamically update text areas on a webpage without the need to refresh the

My goal is to dynamically update the content of a textarea on my webpage when a form is submitted, without having to refresh the entire page. Initially, I attempted to achieve this using AJAX with the following code: $("#db_info").load(document.location.h ...

Combining arrays using the jQuery .each() function

I'm attempting to generate an array from several div id's. Check out my code below: $(function(){ $('#content > div[id^=post]').each(function(){ var ele = Number($(this).attr('id').substr(5,4)); var arr ...

looping through a collection of table rows using v-for

In a Vue app, I am facing an issue with rendering multiple table rows for each item in a collection. The current markup I have for rendering the table body is as follows: <tbody> <template v-for="item in collection"> <tr> < ...

Using Angular-UI typeahead within an ng-repeat loop to conditionally filter specific properties or objects

Imagine I have a set of data that populates my ng-repeat: [ { "name": "Big Bird", "address": "abc street, san francisco california 00000", "object": [ {"a": "b"}, {"c": "d"}, {"e": "f"} ] }, { "address": "abc st ...

Error encountered in Nuxt.js when reloading page due to undefined data

Currently in the process of developing a versatile application with Nuxt.js, I am utilizing a fetch hook and vuex store to retrieve data from an API on most of the pages. I've encountered errors when reloading or refreshing a page, as well as when nav ...

Establishing the redux provider in conjunction with react admin

Looking to implement a redux store in my project without using it in react admin, just in the rest of my application. I have included the usual redux provider code in my src/index.js file: ReactDOM.render( <Provider store={store}> <Ro ...

Resetting the randomness in a function within a sudoku generator implemented in JavaScript

I'm in the process of creating a unique Sudoku generator that incorporates randomness into its design. Within my code, there's a particular function responsible for generating the Sudoku puzzles. The issue I'm encountering is the inability t ...

Node.js Promise delivering less than expected results

I've encountered an issue with a Promise that previously awaited a complete JSON string but now only returns a portion of it. I'm utilizing the Shopify API for customer creation, and this is the expected response structure: { "customer": { ...

Masked input fails to accurately capture data

When utilizing VueJS together with the Quasar framework. An issue arises when using a masked q-input, where the value becomes incorrect after a toggle. For instance, if we start with a default value of: officeNum: 654321, mobileNum: 12345678, Then our ...

The search string selection function retrieves the initial result from a filter and a damaged URL

My goal is to clean up a URL by keeping only specific parameters needed for parsing. I used the pick method along with a regex filter to achieve this. The filter tests if the key in the query parameter matches the regular expression. const groupRegex = new ...

Unusual statement in Java

Similar Question: Arrays with trailing commas inside an array initializer in Java Can someone explain why the following statement is considered correct in Java? int[][] a = { {1,2,}, {3,4}}; Would there be a compilation error due to the unnecessary ...

Filtering a MySQL table by id using JSON data is a practical way to retrieve

Hi there, I'm looking to filter a table using a JSON Array in MySQL. Here's an example: select description from books where id_of_the_book in (jsonarray) I've tried the following approach: set @test = JSON_ARRAY(JSON_OBJECT('id' ...