I use VueJS (in Laravel) to perform simple loop with variable's value.
Here, value comes from the template props.
HTML:
<template id="segment" t_nb=2></template>
<div id="test_loop">
<b>@{{ t_nb }}</b>
<div v-for="a in t_nb">
<seg>@{{ a }}</seg>
</div>
</div>
VueJS:
Vue.component(
'seg', {
template: '#segment',
props: ['t_nb']
}
);
OUTPUT:
<!-- (Empty)-->
Here, i cant get loop for 2 times.
If i pass value of "t_nb" as 2 in direct manner like,
<div v-for="a in 2">
<seg>@{{ a }}</seg>
</div>
then, i get OUTPUT as,
1
2
But i pass same value on both, vuejs only accepts the direct assignment.
Whats wrong with my code ?
How is this possible or any other solutions ?