I have a tab bar in index.wxml, and when I switch tabview, I load the custom template template. At present, we encounter a problem: because the multiple template template under the tab column have a lot of data, it is too complicated to deal with it uniformly in index.js. Is there a good way to introduce a proprietary js scope to the template template corresponding to each tabview, and the data interaction in a single template is handled by its own template.js?
if the tabview, in the red circle in the figure has different template data, it must be very complicated to deal with each template, separately and put the processing method of each template directly into the index.js. How to separate them and correspond one to one?
is the same as the structure of each page file in Mini Program"s:
detail
detail.js
detail.wxml
index
index.js
index.wxml
but not a separate page, but a custom template template?
can also be equivalent to embedding an iframe page in a web page, and the iframe page has its own js scope, but in Mini Program, since there is no iframe component, I made a template corresponding to the tan column switch of a page
Please advise