No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    display funtion's result

    Show & Tell
    2
    2
    928
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zeineb last edited by

      hi! i’m a beginner in the quasar framework , i would know how to display a function’s result , this is my code source

      <template>

      <div>

      <div class="layout-padding">
        <p class="caption">
          La durée de l'emprunt en mois
          <span class="label inline bg-secondary text-white">
            <span class="right-detail"><em>{{value1}}</em> &nbsp;&nbsp;mois</span>
          </span>
        </p>
          
        <q-range v-model="value1" :min="0" :max="300" :step="1" label></q-range>
        
        <p class="caption">
          Le montant emprunté (€)
          <span class="label inline bg-secondary text-white">
            <span class="right-detail"><em>{{value2}}</em> &nbsp;&nbsp;€</span>
          </span>
        </p>
          
        <q-range v-model="value2" :min="0" :max="500000" :step="10" label></q-range>
        
        <p class="caption">
          TEG : Taux Effectif Global annuel
          <span class="label inline bg-secondary text-white">
            <span class="right-detail"><em>{{value3}}</em> &nbsp;&nbsp;%</span>
          </span>
        </p>
          
        <q-range v-model="value3" :min="0" :max="100" :step="0.1" label></q-range>
      

      <p class=“caption”>Mensualité</p>
      <span class=“right-detail” ><em>{{total}}</em> €</span>

      </div>
      

      </div>
      </template>

      <script>
      export default {
      data () {
      return {
      value1: 0,
      value2: 0,
      value3: 0,

      computed: {
      total: function(value1,value2,value3) {
      return (value2*(value3/1200))/(1-Math.pow((1+value3/1200),(-value1)))
      } } } } }
      </script>

      J 1 Reply Last reply Reply Quote 0
      • J
        JCharante @zeineb last edited by JCharante

        @zeineb If what you posted for your <script> tag is correct, then:

        • Your curly braces are out of place
        • In your call to total, you’re not supplying the parameters. Instead our total function won’t take any parameters and will instead use this.foo to get the value of foo.
        • You can’t use -foo to get the negative value of foo
        <script>
          export default {
            data () {
              return {
                value1: 0,
                value2: 0,
                value3: 0,
        
          computed: {
            total: function(value1,value2,value3) {
              return (value2*(value3/1200))/(1-Math.pow((1+value3/1200),(-value1)))
          } } } } }
        </script>
        

        can be converted into

        <script>
          export default {
            data () {
              return {
                value1: 0,
                value2: 0,
                value3: 0,
              }
            },
            computed: {
              total () {
                return (this.value2 * (this.value3 / 1200)) / (1 - Math.pow((1 + this.value3 / 1200), ( this.value1 * -1)))
              }
            }
          }
        </script>
        

        Also, you posted this in Show & Tell. I think a better category would have been Help. And please format the code you post here so it’s easier for people to help you.

        ```
        console.log(‘Hello World’)
        ```

        turns into

        console.log('Hello World')
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post