tested-components.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Vue.component("reactive-chart", {
  2. props: ["chart"],
  3. template: '<div :ref="chart.uuid"></div>',
  4. mounted() {
  5. Plotly.newPlot(this.$refs[this.chart.uuid], this.chart.traces,
  6. this.chart.layout,
  7. {responsive: true, showSendToCloud: true, displaylogo: false}
  8. );
  9. },
  10. watch: {
  11. chart: {
  12. handler: function() {
  13. Plotly.react(
  14. this.$refs[this.chart.uuid],
  15. this.chart.traces,
  16. this.chart.layout
  17. );
  18. },
  19. deep: true
  20. }
  21. }
  22. });
  23. Vue.component('input-with-units',{
  24. // data: function() {return {value: 303.0}},
  25. watch: {
  26. value: {
  27. handler: function () {
  28. this.$emit('newdata',this.value);
  29. }
  30. },
  31. deep: true
  32. },
  33. props: ['title', 'units', 'value'],
  34. template: `
  35. <div class="field has-addons">
  36. <p class="control">
  37. <a class="button is-static" style="width:4rem">
  38. {{ title }}
  39. </a>
  40. </p>
  41. <p class="control">
  42. <b-input v-model="value" type="number" step="any" style="width:6rem"></b-input>
  43. </p>
  44. <p class="control">
  45. <a class="button is-static" style="width:3rem">
  46. {{ units }}
  47. </a>
  48. </p>
  49. </div>
  50. `
  51. })