shims-uni-app.d.ts 3.4 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1
declare namespace UniApp {
fxy060608's avatar
fxy060608 已提交
2 3
  type ClassObj = Record<string, boolean>
  type StyleObj = Record<string, any>
fxy060608's avatar
fxy060608 已提交
4
  type PLATFORM = keyof PagesJsonPagePlatformStyle
fxy060608's avatar
fxy060608 已提交
5 6 7 8 9 10 11 12 13 14
  interface LayoutWindowOptions {
    matchMedia?: {
      minWidth?: number
    }
    style?: Record<string, any>
  }

  interface UniConfig {
    router: {
      strict: boolean
fxy060608's avatar
fxy060608 已提交
15
      base: string
fxy060608's avatar
fxy060608 已提交
16
    }
fxy060608's avatar
fxy060608 已提交
17 18 19 20
    globalStyle: {
      navigationBar: PageNavigationBar
      refreshOptions?: PageRefreshOptions
    }
fxy060608's avatar
fxy060608 已提交
21 22 23 24
    topWindow?: LayoutWindowOptions
    leftWindow?: LayoutWindowOptions
    rightWindow?: LayoutWindowOptions
  }
fxy060608's avatar
fxy060608 已提交
25

fxy060608's avatar
fxy060608 已提交
26
  interface PageNavigationBarButton {
fxy060608's avatar
fxy060608 已提交
27
    type:
fxy060608's avatar
fxy060608 已提交
28 29 30 31 32 33 34 35
      | 'none'
      | 'forward'
      | 'back'
      | 'share'
      | 'favorite'
      | 'home'
      | 'menu'
      | 'close'
fxy060608's avatar
fxy060608 已提交
36
    color: string
fxy060608's avatar
fxy060608 已提交
37
    background?: string
fxy060608's avatar
fxy060608 已提交
38
    badgeText?: string
fxy060608's avatar
fxy060608 已提交
39 40
    colorPressed?: string
    float?: 'right' | 'left'
fxy060608's avatar
fxy060608 已提交
41 42
    fontWeight?: any
    fontSize: string
fxy060608's avatar
fxy060608 已提交
43
    fontSrc?: string
fxy060608's avatar
fxy060608 已提交
44
    fontFamily?: string
fxy060608's avatar
fxy060608 已提交
45
    select?: boolean
fxy060608's avatar
fxy060608 已提交
46
    text: string
fxy060608's avatar
fxy060608 已提交
47
    width?: string
fxy060608's avatar
fxy060608 已提交
48
    redDot?: boolean
fxy060608's avatar
fxy060608 已提交
49
  }
fxy060608's avatar
fxy060608 已提交
50 51

  interface PageNavigationBarSearchInput {
fxy060608's avatar
fxy060608 已提交
52
    color?: string
fxy060608's avatar
fxy060608 已提交
53 54 55 56 57 58 59 60 61
    autoFocus?: boolean
    align?: 'center' | 'left' | 'right'
    backgroundColor?: string
    borderRadius?: string
    placeholder?: string
    placeholderColor?: string
    disabled?: boolean
  }

fxy060608's avatar
fxy060608 已提交
62
  interface PageNavigationBar {
fxy060608's avatar
fxy060608 已提交
63 64
    type?: 'default' | 'transparent' | 'float' | 'none'
    titleText?: string
fxy060608's avatar
fxy060608 已提交
65 66
    titleImage?: string
    titleColor?: '#000' | '#fff'
fxy060608's avatar
fxy060608 已提交
67 68 69 70 71 72 73
    timingFunc?: string
    duration?: string
    backgroundColor?: string
    titlePenetrate?: 'YES' | 'NO'
    shadowColorType?: 'grey' | 'blue' | 'green' | 'orange' | 'red' | 'yellow'
    backButton?: boolean
    buttons?: PageNavigationBarButton[]
fxy060608's avatar
fxy060608 已提交
74 75
    searchInput?: PageNavigationBarSearchInput
    style?: 'default' | 'custom'
fxy060608's avatar
fxy060608 已提交
76 77
    loading?: boolean
    coverage?: string
fxy060608's avatar
fxy060608 已提交
78 79 80 81 82 83 84 85 86
  }
  interface PageRefreshOptions {
    support: boolean
    color: string
    style: 'circle' | string
    height: number
    range: number
    offset: number
  }
fxy060608's avatar
fxy060608 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

  interface PagesJsonPagePlatformStyle {
    h5?: PagesJsonPageStyle
    'app-plus'?: PagesJsonPageStyle
    'mp-alipay'?: PagesJsonPageStyle
    'mp-baidu'?: PagesJsonPageStyle
    'mp-qq'?: PagesJsonPageStyle
    'mp-toutiao'?: PagesJsonPageStyle
    'mp-weixin'?: PagesJsonPageStyle
    'quickapp-webview'?: PagesJsonPageStyle
  }

  interface PagesJsonPageStyle extends PagesJsonPagePlatformStyle {
    enablePullDownRefresh?: boolean
    navigationBar: PageNavigationBar
    refreshOptions?: PageRefreshOptions
  }
  interface PageRouteMeta extends PagesJsonPageStyle {
fxy060608's avatar
fxy060608 已提交
105 106 107 108 109 110 111 112 113
    id: number
    isQuit?: boolean
    isEntry?: boolean
    isTabBar?: boolean
    tabBarIndex?: number
    windowTop?: number
    topWindow?: boolean
    leftWindow?: boolean
    rightWindow?: boolean
fxy060608's avatar
fxy060608 已提交
114 115
  }

fxy060608's avatar
fxy060608 已提交
116 117
  interface PagesJsonPageOptions {
    path: string
fxy060608's avatar
fxy060608 已提交
118
    style: PagesJsonPageStyle
fxy060608's avatar
fxy060608 已提交
119 120 121 122 123 124
  }
  interface PagesJsonSubpackagesOptions {
    root: string
    pages: PagesJsonPageOptions[]
  }

fxy060608's avatar
fxy060608 已提交
125 126 127 128 129 130
  interface PagesJsonWindowOptions extends PagesJsonPageOptions {
    matchMedia: {
      minWidth: number
    }
  }

fxy060608's avatar
fxy060608 已提交
131 132 133 134
  interface PagesJson {
    pages: PagesJsonPageOptions[]
    subpackages?: PagesJsonSubpackagesOptions[]
    subPackages?: PagesJsonSubpackagesOptions[]
fxy060608's avatar
fxy060608 已提交
135
    globalStyle: PagesJsonPageStyle
fxy060608's avatar
fxy060608 已提交
136 137 138
    tabBar?: {
      list: []
    }
fxy060608's avatar
fxy060608 已提交
139 140 141
    topWindow?: PagesJsonWindowOptions
    leftWindow?: PagesJsonWindowOptions
    rightWindow?: PagesJsonWindowOptions
fxy060608's avatar
fxy060608 已提交
142 143
  }
}