Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created March 15, 2017 15:12
Show Gist options
  • Save DeVoresyah/edd184aeddcc9f128450140c04b5c710 to your computer and use it in GitHub Desktop.
Save DeVoresyah/edd184aeddcc9f128450140c04b5c710 to your computer and use it in GitHub Desktop.
Whats wrong paman
<a href='javascript:void(0);' v-on:click='goRegister.redirect(checkSession("hashvirtual_ref"))'><strong>Member</strong> Register</a>
var goRegister = new Vue({
methods: {
redirect: function (username){
if (username != ''){
window.location = 'https://dashboard.hashvirtual.cloud/p/register.html?ref=' + checkSession("hashvirtual_ref");
} else {
window.location = 'https://dashboard.hashvirtual.cloud/p/register.html';
}
}
}
})
@zhiephie
Copy link

zhiephie commented Mar 16, 2017

#JS

var goRegister = new Vue({
   el: '#app',
    methods: {
        redirect: function (username){
            if (username != ''){
                window.location = 'https://dashboard.hashvirtual.cloud/p/register.html?ref=' + checkSession("hashvirtual_ref");
            } else {
                window.location = 'https://dashboard.hashvirtual.cloud/p/register.html';
            }
        }
    }
})

#HTML

<div id="app">
  <button v-on:click="redirect">Redirect</button>
</div>

Note

Vuejs itu bekerja dengan element id atau class. tengok lagi user guidenya. jangan malas baca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment