Hooke

no message

......@@ -7,16 +7,16 @@
</p>
<child :level="1">Hello world!</child>
<child :level="3">Hello world!</child>
<my-paragraph></my-paragraph>
</div>
</template>
<script>
import counter from './components/counter.vue'
import child from './components/child.vue'
import myParagraph from './components/myParagraph.vue'
import {
store
} from './main.js'
import { store } from './main.js'
export default {
name: 'app',
......@@ -39,7 +39,7 @@ export default {
}
},
components: {
counter,child
counter,child,myParagraph
}
}
</script>
......
<script>
var getChildrenTextContent = function(children) {
return children.map(function(node) {
return node.children ?
getChildrenTextContent(node.children) :
node.text
}).join('')
}
export default {
data() {
return {
}
},
computed: {
},
mounted() {
},
computed: {},
mounted() {},
methods: {},
components: {},
render: function(createElement) {
var headingId = getChildrenTextContent(this.$slots.default)
.toLowerCase()
.replace(/\W+/g, '-')
.replace(/(^\-|\-$)/g, '')
return createElement(
'h' + this.level,
this.$slots.default
[
createElement('a', {
attrs: {
name: headingId,
href: '#' + headingId
}
}, this.$slots.default)
]
)
},
props: {
......
<script>
export default {
data() {
return {}
},
computed: {},
mounted() {},
methods: {},
components: {},
render: function(createElement) {
// var myParagraphVNode = createElement('p', 'hi')
// return createElement('div', [
// // Yikes - duplicate VNodes!
// myParagraphVNode, myParagraphVNode
// ])
return createElement('div',
Array.apply(null, {
length: 10
}).map(function() {
return createElement('p', 'hi')
})
)
}
}
</script>