index.html 1.4 KB

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