Просмотр исходного кода

fix svg example post component change

Evan You 11 лет назад
Родитель
Сommit
2cf4c67d2d
2 измененных файлов с 8 добавлено и 3 удалено
  1. 6 3
      examples/svg/index.html
  2. 2 0
      examples/svg/svg.js

+ 6 - 3
examples/svg/index.html

@@ -12,9 +12,12 @@
     <script type="text/x-template" id="polygraph-template">
       <polygon v-attr="points:points"></polygon>
       <circle cx="100" cy="100" r="80"></circle>
-      <text v-repeat="stats" v-component="axis-label" v-attr="x:point.x, y:point.y">
-        {{label}}
-      </text>
+      <text v-repeat="stats" v-component="axis-label"></text>
+    </script>
+
+    <!-- template for the axis label component. -->
+    <script type="text/x-template" id="axis-label-template">
+      <text v-attr="x:point.x, y:point.y">{{label}}</text>
     </script>
 
     <!-- demo root element -->

+ 2 - 0
examples/svg/svg.js

@@ -24,6 +24,8 @@ Vue.component('polygraph', {
   components: {
     // a sub component for the labels
     'axis-label': {
+      template: '#axis-label-template',
+      replace: true,
       computed: {
         point: function () {
           return valueToPoint(