Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <template id="userbox_button">
  2. <a v-if="count > 0" class="kiwi-userbox-action" @click="buttonClicked($event)">
  3. <i class="fa fa-warning" aria-hidden="true"></i>
  4. Do NOT Press
  5. </a>
  6. </template>
  7. <script>
  8. kiwi.plugin('test_userbox_button', function(kiwi, log) {
  9.  
  10. var userboxButton = kiwi.Vue.extend({
  11. template: '#userbox_button',
  12. data: function data() {
  13. return {
  14. count: 10,
  15. };
  16. },
  17. methods: {
  18. buttonClicked: function buttonClicked(event) {
  19. console.log('pressed', event);
  20. console.log('nick:', event.target.parentElement.dataset.nick);
  21. if (this.count <= 0) {
  22. return;
  23. }
  24. console.log(this.count+'...');
  25. this.count--;
  26. },
  27. },
  28. });
  29.  
  30. var buttonComponent = new userboxButton();
  31. buttonComponent.$mount();
  32. kiwi.addUi('userbox_button', buttonComponent.$el);
  33.  
  34. var b2 = new userboxButton();
  35. b2.$mount();
  36. kiwi.addUi('userbox_button', b2.$el);
  37.  
  38. var b3 = new userboxButton();
  39. b3.$mount();
  40. kiwi.addUi('userbox_button', b3.$el);
  41. });
  42. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement