_Cart.vue 824 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script>
  2. import Vue from 'vue'
  3. export default {
  4. props: ['html'], // get the html from parent with props
  5. data() {
  6. return {
  7. template: null // compiled template from html used in render
  8. }
  9. },
  10. beforeMount() {
  11. // console.log('Home beforeMount')
  12. // compile the html src (coming from parent with props or from ajax call)
  13. if (this.html) {
  14. console.log('html', this.html)
  15. this.template = Vue.compile(this.html)
  16. this.$options.staticRenderFns = []
  17. this._staticTrees = []
  18. this.template.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)))
  19. }
  20. },
  21. render(h) {
  22. if (!this.template) {
  23. return h('span', $t('default.Loading…'))
  24. } else {
  25. return this.template.render.call(this)
  26. }
  27. }
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. </style>