You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
  1. # uni-tpl
  2. 没有用到的不要引入, 否则会被打包进项目
  3. ### 分包
  4. pages 下的一级目录
  5. ### 国际化
  6. [https://uniapp.dcloud.io/collocation/i18n?id=pages](https://uniapp.dcloud.io/collocation/i18n?id=pages)
  7. ```
  8. npm install i18n --save
  9. ```
  10. main.js
  11. ```
  12. import en from './locale/en.json'
  13. import zhHans from './locale/zh-Hans.json'
  14. const messages = {
  15. en,
  16. 'zh-Hans': zhHans,
  17. }
  18. let i18nConfig = {
  19. locale: uni.getLocale(),
  20. messages
  21. }
  22. import VueI18n from 'vue-i18n'
  23. Vue.use(VueI18n)
  24. const i18n = new VueI18n(i18nConfig)
  25. const app = new Vue({
  26. i18n,
  27. ...App
  28. })
  29. ```
  30. ### 组件库
  31. - [uview-ui](https://v1.uviewui.com/components/intro.html)
  32. ```
  33. import {MescrollMixin, MescrollCompMixin} from '@/common/utils/MescrollMap'
  34. ```
  35. - [mescroll](https://www.mescroll.com/uni.html#mescrollbody)
  36. ### api
  37. 一个页面需要多个模块
  38. ```
  39. import {LoginApi, UserApi} from '@/api'
  40. ```
  41. 一个页面只需一个模块
  42. ```
  43. import LoginApi from '@/api/modules/Login'
  44. ```