CSS.uvue 11.2 KB
Newer Older
M
mehaotian 已提交
1
<template>
W
wanganxp 已提交
2
  <!-- #ifdef APP -->
W
wanganxp 已提交
3
  <scroll-view style="flex: 1" enable-back-to-top="true">
4
  <!-- #endif -->
W
wanganxp 已提交
5 6 7 8
    <view class="uni-container">
      <view class="uni-header-logo">
        <image class="uni-header-image" src="/static/cssIndex.png"></image>
      </view>
Y
yurj26 已提交
9
      <view class="uni-text-box">
W
wanganxp 已提交
10
        <text class="hello-text">uni-app x目前已支持的CSS属性,展示样式仅供参考,文档详见:</text>
W
wanganxp 已提交
11
        <u-link :href="'https://uniapp.dcloud.io/uni-app-x/css/'" :text="'https://uniapp.dcloud.io/uni-app-x/css/'"
W
wanganxp 已提交
12 13 14 15 16 17 18 19 20
          :inWhiteList="true"></u-link>
      </view>
      <uni-collapse>
        <template v-for="item in list" :key="item.id">
          <uni-collapse-item :title="item.name" class="item">
            <view class="uni-navigate-item" :hover-class="page.enable == false?'':'is--active'"
              v-for="(page, key) in item.pages" :key="key" @click="goDetailPage(page)">
              <text class="uni-navigate-text"
                :class="page.enable == false ? 'text-disabled' : ''">{{ page.name }}</text>
21
              <image :src="arrowRightIcon" class="uni-icon-size"></image>
W
wanganxp 已提交
22 23 24 25 26
            </view>
          </uni-collapse-item>
        </template>
      </uni-collapse>
    </view>
27
  <!-- #ifdef APP -->
W
wanganxp 已提交
28 29
  </scroll-view>
  <!-- #endif -->
M
mehaotian 已提交
30 31
</template>

Y
yurj26 已提交
32
<script lang="uts">
W
wanganxp 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
  type Page = {
    name : string
    enable ?: boolean
    url ?: string
  }
  type ListItem = {
    id : string
    name : string
    pages : Page[]
    url ?: string
    enable ?: boolean
  }
  export default {
    data() {
      return {
        list: [
          {
            id: 'background',
            name: 'background',
            pages: [
              {
                name: 'background-color',
                url: '/pages/CSS/background/background-color',
              },
              {
                name: 'background-image',
                url: '/pages/CSS/background/background-image',
              },
            ] as Page[],
          },
          {
            id: 'border',
            name: 'border',
            pages: [
              {
                name: 'border',
                url: '/pages/CSS/border/border',
              },
              {
                name: 'border-width',
                url: '/pages/CSS/border/border-width',
              },
              {
                name: 'border-style',
                url: '/pages/CSS/border/border-style',
              },
              {
                name: 'border-color',
                url: '/pages/CSS/border/border-color',
              },
              {
                name: 'border-radius',
                url: '/pages/CSS/border/border-radius',
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
              },
              {
                name: 'border-top',
                url: '/pages/CSS/border/border-top',
              },
              {
                name: 'border-bottom',
                url: '/pages/CSS/border/border-bottom',
              },
              {
                name: 'border-left',
                url: '/pages/CSS/border/border-left',
              },
              {
                name: 'border-right',
                url: '/pages/CSS/border/border-right',
W
wanganxp 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
              },
              {
                name: 'border属性复合示例',
                url: '/pages/CSS/border/complex-border/complex-border',
              },
            ] as Page[],
          },
          {
            id: 'box-shadow',
            name: 'box-shadow',
            pages: [
              {
                name: 'box-shadow',
                url: '/pages/CSS/box-shadow/box-shadow',
              },
            ] as Page[],
          },
          {
            id: 'display',
            name: 'display',
            pages: [
              {
                name: 'flex',
                url: '/pages/CSS/display/flex',
              },
              {
                name: 'none',
                url: '/pages/CSS/display/none',
              }
            ] as Page[],
          },
          {
            id: 'flex',
            name: 'flex',
            pages: [
              {
                name: 'align-content',
                url: '/pages/CSS/flex/align-content',
              },
              {
                name: 'align-items',
                url: '/pages/CSS/flex/align-items',
              },
              {
                name: 'flex-basis',
                url: '/pages/CSS/flex/flex-basis',
              },
              {
                name: 'flex-direction',
                url: '/pages/CSS/flex/flex-direction',
              },
              {
                name: 'flex-flow',
                url: '/pages/CSS/flex/flex-flow',
              },
              {
                name: 'flex-grow',
                url: '/pages/CSS/flex/flex-grow',
              },
              {
                name: 'flex-shrink',
                url: '/pages/CSS/flex/flex-shrink',
              },
              {
                name: 'flex',
                url: '/pages/CSS/flex/flex',
              },
              {
                name: 'justify-content',
                url: '/pages/CSS/flex/justify-content',
              },
            ] as Page[],
          },
          {
            id: 'layout',
            name: 'layout',
            pages: [
              {
                name: 'height',
                url: '/pages/CSS/layout/height',
              },
              {
                name: 'max-height',
                url: '/pages/CSS/layout/max-height',
              },
              {
                name: 'max-width',
                url: '/pages/CSS/layout/max-width',
              },
              {
                name: 'min-height',
                url: '/pages/CSS/layout/min-height',
              },
              {
                name: 'min-width',
                url: '/pages/CSS/layout/min-width',
              },
              {
                name: 'position',
                url: '/pages/CSS/layout/position',
              },
              {
                name: 'width',
                url: '/pages/CSS/layout/width',
206 207 208 209
              },
              {
                name: 'z-index',
                url: '/pages/CSS/layout/z-index',
W
wanganxp 已提交
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
              },
              {
                name: 'visibility',
                url: '/pages/CSS/layout/visibility',
              },
            ] as Page[],
          },
          {
            id: 'margin',
            name: 'margin',
            pages: [
              {
                name: 'margin-bottom',
                url: '/pages/CSS/margin/margin-bottom',
              },
              {
                name: 'margin-left',
                url: '/pages/CSS/margin/margin-left',
              },
              {
                name: 'margin-right',
                url: '/pages/CSS/margin/margin-right',
              },
              {
                name: 'margin-top',
                url: '/pages/CSS/margin/margin-top',
              },
              {
                name: 'margin',
                url: '/pages/CSS/margin/margin',
              },
            ] as Page[],
          },
          {
            id: 'padding',
            name: 'padding',
            pages: [
              {
                name: 'padding-bottom',
                url: '/pages/CSS/padding/padding-bottom',
              },
              {
                name: 'padding-left',
                url: '/pages/CSS/padding/padding-left',
              },
              {
                name: 'padding-right',
                url: '/pages/CSS/padding/padding-right',
              },
              {
                name: 'padding-top',
                url: '/pages/CSS/padding/padding-top',
              },
              {
                name: 'padding',
                url: '/pages/CSS/padding/padding',
              },
            ] as Page[],
268 269 270 271 272 273 274 275 276 277
          },
          {
            id: 'overflow',
            name: 'overflow',
            pages: [
              {
                name: 'overflow',
                url: '/pages/CSS/overflow/overflow',
              },
            ] as Page[],
W
wanganxp 已提交
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
          },
          {
            id: 'text',
            name: 'text',
            pages: [
              {
                name: 'color',
                url: '/pages/CSS/text/color',
              },
              {
                name: 'font-family',
                url: '/pages/CSS/text/font-family',
              },
              {
                name: 'font-size',
                url: '/pages/CSS/text/font-size',
              },
              {
                name: 'font-style',
                url: '/pages/CSS/text/font-style',
              },
              {
                name: 'font-weight',
                url: '/pages/CSS/text/font-weight',
              },
              {
                name: 'letter-spacing',
                url: '/pages/CSS/text/letter-spacing',
              },
              {
                name: 'line-height',
                url: '/pages/CSS/text/line-height',
              },
              {
                name: 'text-align',
                url: '/pages/CSS/text/text-align',
              },
              {
                name: 'text-overflow',
                url: '/pages/CSS/text/text-overflow',
              },
              {
                name: 'text-decoration-line',
                url: '/pages/CSS/text/text-decoration-line',
              },
            ] as Page[],
          },
          {
            id: 'transform',
            name: 'transform',
            pages: [
              {
                name: 'translate',
                url: '/pages/CSS/transform/translate',
              },
              {
                name: 'scale',
                url: '/pages/CSS/transform/scale',
              },
              {
                name: 'rotate',
                url: '/pages/CSS/transform/rotate',
              },
            ] as Page[],
          },
          {
            id: 'transition',
            name: 'transition',
            pages: [
              {
                name: 'transition',
                url: '/pages/CSS/transition/transition',
              },
            ] as Page[],
352 353 354 355 356 357 358 359 360 361
          },
          {
            id: 'variable',
            name: 'variable',
            pages: [
              {
                name: 'variable',
                url: '/pages/CSS/variable/variable',
              },
            ] as Page[],
W
wanganxp 已提交
362
          }
W
wanganxp 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
        ] as ListItem[],
        arrowUpIcon: '/static/icons/arrow-up.png',
        arrowDownIcon: '/static/icons/arrow-down.png',
        arrowRightIcon: '/static/icons/arrow-right.png',
      }
    },
    methods: {
      goDetailPage(e : Page) {
        if (e.enable == false) {
          uni.showToast({
            icon: 'none',
            title: '暂不支持',
          })
          return
        }
        const url = e.url != null ? e.url! : `/pages/CSS/${e.name}/${e.name}`
        uni.navigateTo({
          url,
        })
      },
    },
  }
M
mehaotian 已提交
385 386 387
</script>

<style>
W
wanganxp 已提交
388 389 390
  .item {
    margin-bottom: 12px;
  }
Y
yurj26 已提交
391
</style>