版博士V2.0程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

base.cjs 677 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * 获取扩展名
  3. * @param {string} type 模块类型
  4. * @param {boolean} isMarkdown 是否是 markdown,默认为 false
  5. * @returns {string} 扩展名
  6. */
  7. const showExt = (type, isMarkdown = false) => {
  8. const isTs = type === 'api' || type === 'store' || type === 'module'
  9. const ext = isMarkdown ? 'md' : isTs ? 'ts' : 'vue'
  10. return ext
  11. }
  12. /**
  13. * 模块类型
  14. */
  15. const moduleTypes = [
  16. 'api',
  17. 'page',
  18. 'store',
  19. 'layout',
  20. 'module',
  21. 'component',
  22. 'composable',
  23. ]
  24. /**
  25. * 获取目录
  26. * @param {string} type 类型
  27. */
  28. const showDir = (type) => {
  29. if (type === 'api') {
  30. return 'api'
  31. }
  32. return `${type}s`
  33. }
  34. module.exports = {
  35. showExt,
  36. showDir,
  37. moduleTypes,
  38. }