2
0

index.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue.js SVG example</title>
  6. <link rel="stylesheet" href="style.css">
  7. <script src="../../dist/vue.js"></script>
  8. </head>
  9. <body>
  10. <!-- template for the polygraph component. -->
  11. <script type="text/x-template" id="polygraph-template">
  12. <g>
  13. <polygon :points="points"></polygon>
  14. <circle cx="100" cy="100" r="80"></circle>
  15. <axis-label
  16. v-for="stat in stats"
  17. :stat="stat"
  18. :index="$index"
  19. :total="stats.length">
  20. </axis-label>
  21. </g>
  22. </script>
  23. <!-- template for the axis label component. -->
  24. <script type="text/x-template" id="axis-label-template">
  25. <text :x="point.x" :y="point.y">{{stat.label}}</text>
  26. </script>
  27. <!-- demo root element -->
  28. <div id="demo">
  29. <!-- Use the component -->
  30. <svg width="200" height="200">
  31. <polygraph :stats="stats"></polygraph>
  32. </svg>
  33. <!-- controls -->
  34. <div v-for="stat in stats">
  35. <label>{{stat.label}}</label>
  36. <input type="range" v-model="stat.value" min="0" max="100">
  37. <span>{{stat.value}}</span>
  38. <button @click="remove(stat)">X</button>
  39. </div>
  40. <form id="add">
  41. <input name="newlabel" v-model="newLabel">
  42. <button @click="add">Add a Stat</button>
  43. </form>
  44. <pre id="raw">{{stats | json}}</pre>
  45. </div>
  46. <p style="font-size:12px">* input[type="range"] requires IE10 or above.</p>
  47. <script src="svg.js"></script>
  48. </body>
  49. </html>