I'm working on an Application which is already build for one country. Now it is required to scale it to multiple countries (20+) with minor changes in each component. How to implement for making code reusable and scalable, ways I thought:
App structure/Code: There is a form whose fields and validations will change based on country. Plus few banners whose banner layout is based on country.
Would like to know how we can architect such Vue.js Application ?
很难看到所有代码,但是如果您已经在使用i18n更改语言字符串并且所做的更改确实很小,我认为v-if是您的最佳选择。
Instead of having v-ifs, I'd delegate this logic to a custom component:
Instead of:
<h2>Country Specific</h2>
<v-if="country=='A'>
<v-if="country=='B'>
<v-if="country=='C'>
etc...
Do this:
<h2>Country Specific</h2>
<custom-module country="currentCountry"/>
and group all these "per country" modules under a specific folder separate from your "global/shared" system.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.