halower / vue-tree

tree and multi-select component based on Vue.js 2.0
https://github.com/halower/vue2-tree/blob/master/README.md
MIT License
935 stars 209 forks source link

tpl method gives error in laravel #170

Open jsinhSolanki opened 5 years ago

jsinhSolanki commented 5 years ago

Hello, Thanks for great tree component. I used your demo for laravel project. I copied this code, and pasted in my laravel project. This is giving me error in my laravel project as follow.

  134 |       let titleClass = node.selected ? 'node-title node-selected' : 'node-title'
  135 |       if (node.searched) titleClass += ' node-searched'
> 136 |       return <span>
      |              ^
  137 |         <span class="tree-expand" onClick={() => this.$refs.tree.addNode(node, {title: 'sync node'})}>+</span>
  138 |          <span class={titleClass} domPropsInnerHTML={node.title} onClick={() => {
  139 |            this.$refs.tree.nodeSelected(node)
    at Parser.raise 

However above code works fine if I only use VueJS. Can you please help me with this.

~ Thanks

halower commented 5 years ago

it’s a shame, mainly because we are not familiar with PHP, so i don't know how to install the corresponding plugin(maybe, etc transform-vue-jsx) to supprot syntax of jsx, (halower@foxmail.com), it my email ,if you need further communication, can contact me.

5SMNOONMS5 commented 3 years ago

Maybe a little late I have same problem with same environment using Laravel and Vue2 finally here is my workaround

<v-tree ref="tree"
                :canDeleteRoot="false"
                :data="treeData2"
                :draggable="true"
                :multiple="true" 
                :tpl="tpl"                  <<<<<< do not use tpl
/>

Put your html code inside your tree data

title: 'node 1-1-3 <h1>title</h1>'

This require you deal with your tree data first.