So I basicly have 2 scripts. A user script that handles the user login, check ect. And a script that handle actions on a page. Now I want to be able to show a button controlled by the page script, but only show that button if the user is logged in. This button is in the page script element, therfore I can't accsess it through the user script. This would also be very messy.
Heres some code to explain what I have tried to do:
user.js:
var userAuth = new Vue({
el: '#userSegment',
data: { 'loggedin': false, },
ready: function(){
if(userLoggedIn){ this.loggedin = true; }else{ this.loggedin = false; }
},
});
page.js
new Vue({
el: '#body',
data: { 'buttonclicked': false, },
method: {
clicked: function(){ this.buttonclicked = true; },
},
});
index.html:
<html>
<div id='userSegment></div>
<div id='body'>
<button v-if='userAuth.loggedIn' v-on='click: clicked()' >
Click Me
</button>
</div>
//both the script links are here. Dont worrie
</html>
But the button is not showing when the user is logged in. Sorry if the solution is stupidly simple, but yet again the documentation for this framework (like every 4 in 5) is awful and a mess.