in Vue.JS by
Q:
Example of Vue app there same app made using render functions:

1 Answer

0 votes
by

new Vue({
  el: '#app',
  data: {
    fruits: ['Apples', 'Oranges', 'Kiwi']
  },
  render: function(createElement) {
    return createElement('div', [
      createElement('h1', 'Fruit Basket'),
      createElement('ol', this.fruits.map(function(fruit) { 
        return createElement('li', fruit); 
      }))
    ]);
  }
});

Outputs:

Fruit Basket

  1. Apples
  2. Oranges
  3. Kiwi

In the above example, we’re using a function that returns a series of createElement() invocations, each of which is responsible for generating an element. While the v-for directive does the job in the case of HTML based templates, when using render functions we can simply use the standard .map() function to loop over the fruits data Array.

Click here to read more about Vue JS
Click here to read more about Insurance

Related questions

0 votes
asked Jan 9, 2020 in Vue.JS by GeorgeBell
0 votes
asked Jul 24, 2020 in Ionic by Robindeniel
0 votes
asked Jan 9, 2020 in Vue.JS by GeorgeBell
0 votes
asked Dec 18, 2020 in SVN by SakshiSharma
0 votes
asked Jan 9, 2020 in Vue.JS by GeorgeBell
0 votes
asked Jan 9, 2020 in Vue.JS by GeorgeBell
0 votes
asked Jan 9, 2020 in Vue.JS by GeorgeBell
...