cakephp - VueJS - 2 controllers in 1 file -


how make 2 controllers work in 1 view?

for example, view simplified (using cakephp 3's element page rendering):

<div id="main">     <div id="sub">         <?= $this->element('main/sub'); ?>     </div> </div> 

and controllers (i use requirejs):

require(['jquery', 'vue'], function ($, vue) {     return new vue({         el: '#main',         data: {         },     }); });  require(['jquery', 'vue'], function ($, vue) {     return new vue({         el: '#sub',         data: {         },     }); }); 

i keep getting error , data in #sub won't render in dom.

vue.js:1141 [vue warn]: avoid using reserved keywords in expression: return false;

i'm new vuejs i'm unsure if correct setup or not.

requirejs.config({     baseurl: 'js', // app base url     paths: {         vue: 'lib/vue', // /js/lib/vue.js library         component1: 'components/component1', // /js/components/component1.js         component2: 'components/component2' // /js/components/component2.js     } });  require(['vue', 'component1', 'component2'], function(vue, c1, c2){      var app = new vue({         el: '#app',         data: {},         components: {           component1: c1,           component2: c2         }      }); }); 

html:

<div id="app">   <component1></component1>   <component2></component2> </div> 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -