counter.js 627 B

1234567891011121314151617181920212223
  1. Vue.component("counter", {
  2. template: `
  3. <button v-bind:id="jp_props.id" v-on:click="handle_click">
  4. <strong>{{jp_props.options.title}}: {{jp_props.options.value}}</strong>
  5. </button>`,
  6. methods: {
  7. handle_click() {
  8. this.$props.jp_props.options.value += 1;
  9. const event = {
  10. event_type: "onChange",
  11. vue_type: this.$props.jp_props.vue_type,
  12. id: this.$props.jp_props.id,
  13. page_id: page_id,
  14. websocket_id: websocket_id,
  15. value: this.$props.jp_props.options.value,
  16. };
  17. send_to_server(event, "event");
  18. },
  19. },
  20. props: {
  21. jp_props: Object,
  22. },
  23. });