Uzenkov
13
10
Vue

Changing the value in real time

Posted 1 year ago by Uzenkov

Hello everybody! Can someone tell me the correct solution of the problem? I need the counter to be changed when an element is added.

I have the following...

ShowReminders.vue

<template>
  <el-badge :value="reminders.count" class="item">
    <span uk-icon="icon: bell"></span>
  </el-badge>
</template>

<script>

  export default {

    data() {
      return {
        reminders: {
          count: window.reminders.length
        }
      }
    }

  }

</script>

CreateLead.vue

<template>
...
<el-button type="success" @click="addLead" round>Add Lead</el-button>
</template>

<script>
  export default {

    ...

    addLead() {
      window.reminders.length++ // it doesn't work
      ...
    }

    ...

  }
</script>

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.