I'm using the v-for loop for rendering HTML. I want to create one variable outside this for loop and want to use within th for loop while rendering HTML.
Using PHP, I can achieve same scenario.
$array = ["abc","abc","xyz","xyz","abc","xyz"];
$new = '';
foreach($array as $val) {
if(($new == '' || $new == 'xyz') && $val == 'abc') {
echo "--- ";
}
echo $val;
if(($new == '' || $new == 'abc') && $val == 'xyz') {
echo " ---";
}
$new = $val;
echo "<br>";
} Output
--- abc
abc
xyz ---
xyz
--- abc
xyz ---
How can I achieve the same with the vueJs. I tried,
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZQmYwz
via IFTTT
Aucun commentaire:
Enregistrer un commentaire