I've been attempting to eliminate white space from a property of one of the returned objects using the .trim() function, but it's not working as expected.
Even after trying JavaScript functions like .replace(/\s/g,''), the issue persists.
<script>
export default {
name: 'navigation',
props: ["navigation"],
methods:{
whiteSpace: function(a){
var str = a;
str.toLowerCase();
str.trim();
console.log(str);
return str;
}
}
}
</script>
HTML
<li>
<router-link :to="{ path: whiteSpace(nav.linkTitle) }">
{{nav.linkTitle}}
</router-link>
</li>
The intended outcome is to have a string without any white space characters, however, the current implementation does not remove them effectively.