index.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. <polygon v-attr="points:points"></polygon>
  13. <circle cx="100" cy="100" r="80"></circle>
  14. <text v-repeat="stats" v-component="axis-label" v-attr="x:point.x, y:point.y">
  15. {{label}}
  16. </text>
  17. </script>
  18. <!-- demo root element -->
  19. <div id="demo">
  20. <!-- Use the component -->
  21. <svg width="200" height="200">
  22. <g v-component="polygraph" v-with="stats:stats"></g>
  23. </svg>
  24. <!-- controls -->
  25. <div v-repeat="stats">
  26. <label>{{label}}</label>
  27. <input type="range" v-model="value" min="0" max="100">
  28. <span>{{value}}</span>
  29. <button v-on="click:remove(this)">X</button>
  30. </div>
  31. <form id="add">
  32. <input name="newlabel" v-model="newLabel">
  33. <button v-on="click:add">Add a Stat</button>
  34. </form>
  35. <pre id="raw">{{stats | json}}</pre>
  36. </div>
  37. <p style="font-size:12px">* input[type="range"] requires IE10 or above.</p>
  38. <script src="svg.js"></script>
  39. </body>
  40. </html>