API.uvue 20.2 KB
Newer Older
Y
init  
yurj26 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 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 206 207 208 209 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 268 269 270 271 272 273 274 275 276 277 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 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459



























    type Page = {
        name : string,
        enable ?: boolean,
        url : string
    }
    type ListItem = {
        id : string,
        name : string,
        open : boolean,
        pages : Page[],
        url ?: string,
        enable ?: boolean
    }
    export default {
        data() {
            return {
                list: [{
                    id: "page",
                    name: "界面",
                    open: false,
                    pages: [
                        {
                            name: "设置导航条",
                            url: "set-navigation-bar-title"
                        },

                        {
                            name: "原生子窗体",
                            url: "subnvue",
                        },

                        {
                            name: "页面跳转",
                            url: "navigator",
                            enable: true
                        },

                        {
                            name: "设置TabBar",
                            url: "set-tabbar",
                        },

                        {
                            name: "下拉刷新",
                            url: "pull-down-refresh",
                        },
                        {
                            name: "创建动画",
                            url: "animation",
                        },

                        {
                            name: "创建绘画",
                            url: "canvas",
                        },


                        {
                            name: "节点信息",
                            url: "get-node-info",
                        },

                        {
                            name: "节点布局交互状态",
                            url: "intersection-observer",
                        },
                        {
                            name: "显示操作菜单",
                            url: "action-sheet",
                        },
                        {
                            name: "显示模态弹窗",
                            url: "modal",
                        },
                        {
                            name: "显示加载提示框",
                            url: "show-loading",
                        },
                        {
                            name: "显示消息提示框",
                            url: "toast",
                        },
                    ] as Page[],
                },
                {
                    id: "device",
                    name: "设备",
                    open: false,
                    pages: [
                        {
                            name: "获取设备网络状态",
                            url: "get-network-type",
                        },
                        {
                            name: "获取设备系统信息",
                            url: "get-system-info",
                        },
                        {
                            name: "打电话",
                            url: "make-phone-call",
                        },

                        {
                            name: "震动",
                            url: "vibrate",
                        },
                        {
                            name: "添加手机联系人",
                            url: "add-phone-contact",
                        },
                        {
                            name: "扫码",
                            url: "scan-code",
                        },


                        {
                            name: "剪贴板",
                            url: "clipboard",
                        },


                        {
                            name: "屏幕亮度",
                            url: "brightness",
                        },


                        {
                            name: "蓝牙",
                            url: "bluetooth",
                        },


                        {
                            name: "生物认证",
                            url: "soter",
                        },


                        {
                            name: "iBeacon",
                            url: "ibeacon",
                        },


                        {
                            name: "监听加速度传感器",
                            url: "on-accelerometer-change",
                        },


                        {
                            name: "监听罗盘数据",
                            url: "on-compass-change",
                        },


                        {
                            name: "监听距离传感器",
                            url: "/platforms/app-plus/proximity/proximity",
                        },
                        {
                            name: "监听方向传感器",
                            url: "/platforms/app-plus/orientation/orientation",
                        },

                    ] as Page[],
                },
                {
                    id: "network",
                    name: "网络",
                    open: false,
                    pages: [
                        {
                            name: "发起一个请求",
                            url: "request",
                        },
                        {
                            name: "上传文件",
                            url: "upload-file",
                        },
                        {
                            name: "下载文件",
                            url: "download-file",
                        },
                    ] as Page[],
                },
                {
                    id: "websocket",
                    name: "websocket",
                    open: false,
                    pages: [

                        {
                            name: "socketTask",
                            url: "websocket-socketTask",
                        },

                        {
                            name: "全局websocket",
                            url: "websocket-global",
                        },
                    ] as Page[],
                },
                {
                    id: "media",
                    name: "媒体",
                    open: false,
                    pages: [
                        {
                            name: "图片",
                            url: "image",
                        },

                        {
                            name: "音频",
                            url: "inner-audio",
                        },


                        {
                            name: "录音",
                            url: "voice",
                        },
                        {
                            name: "背景音频",
                            url: "background-audio",
                        },


                        {
                            name: "视频",
                            url: "video",
                        },


                        {
                            name: "文件",
                            url: "file",
                        },


                        {
                            name: "保存媒体到本地",
                            url: "save-media",
                        },

                    ] as Page[],
                },

                {
                    id: "location",
                    name: "位置",
                    open: false,
                    pages: [
                        {
                            name: "获取当前位置",
                            url: "get-location",
                        },
                        {
                            name: "使用地图查看位置",
                            url: "open-location",
                        },

                        {
                            name: "使用地图选择位置",
                            url: "choose-location",
                        },


                        {
                            name: "地图控制",
                            url: "map",
                        },


                        {
                            name: "地图搜索",
                            url: "map-search",
                        },

                    ] as Page[],
                },

                {
                    id: "storage",
                    name: "数据",
                    open: false,
                    pages: [
                        {
                            name: "数据存储(key-value)",
                            url: "storage",
                        },

                        {
                            name: "SQLite",
                            url: "sqlite",
                        },

                    ] as Page[],
                },

                {
                    id: "rewarded-video-ad",
                    url: "rewarded-video-ad",
                    name: "激励视频广告",
                    open: false,
                    enable: false,
                    pages: [] as Page[]
                },


                {
                    id: "full-screen-video-ad",
                    url: "full-screen-video-ad",
                    name: "全屏视频广告",
                    open: false,
                    enable: false,
                    pages: [] as Page[]
                },


                {
                    id: "login",
                    name: "登录",
                    open: false,
                    pages: [
                        {
                            name: "登录",
                            url: "login",
                        },
                        {
                            name: "获取用户信息",
                            url: "get-user-info",
                        },
                    ] as Page[],
                },


                {
                    id: "share",
                    name: "分享",
                    open: false,
                    pages: [
                        {
                            name: "分享",
                            url: "share",
                        },
                    ] as Page[],
                },


                {
                    id: "payment",
                    name: "支付",
                    open: false,
                    pages: [
                        {
                            name: "发起支付",
                            url: "request-payment",
                        },
                    ] as Page[],
                },


                {
                    id: "speech",
                    name: "语音",
                    open: false,
                    pages: [
                        {
                            name: "语音识别",
                            url: "/platforms/app-plus/speech/speech",
                        },
                    ] as Page[],
                },
                {
                    id: "push",
                    name: "推送",
                    open: false,
                    pages: [
                        {
                            name: "推送",
                            url: "/platforms/app-plus/push/push",
                        },
                    ] as Page[],
                },

                ] as ListItem[],
                arrowUpIcon: '/static/icons/arrow-up.png',
                arrowDownIcon: '/static/icons/arrow-down.png',
                arrowRightIcon: '/static/icons/arrow-right.png',
            }
        },
        methods: {
            triggerCollapse(index ?: number, item : ListItem) {
                if (item.pages.length == 0) {
                    const page : Page = {
                        name: item.name,
                        enable: item.enable,
                        url: item.url!
                    }
                    this.goDetailPage(page);
                    return;
                }
                for (var i = 0; i < this.list.length; ++i) {
                    if (index == i) {
                        this.list[i].open = !this.list[i].open;
                    } else {
                        this.list[i].open = false;
                    }
                }
            },
            goDetailPage(e : Page) {
                if (e.enable != true) {
                    uni.showToast({
                        icon: 'none',
                        title: '暂不支持'
                    })
                    return
                }
                const url = e.url.indexOf('platform') > -1 ? e.url : `/pages/API/${e.url}/${e.url}`
                uni.navigateTo({
                    url
                })
            }
        }
    }


const GenPagesTabBarAPIAPIStyles = [new Map<string, Map<string, Map<string, any>>>([["text", new Map<string, any>([["", new Map<string, any>([["color", "#7A7E83"], ["fontSize", 14], ["lineHeight", 20]])]])], ["uni-icon", new Map<string, any>([["", new Map<string, any>([["width", 14], ["height", 14]])]])], ["uni-container", new Map<string, any>([["", new Map<string, any>([["paddingTop", 15], ["paddingRight", 15], ["paddingBottom", 15], ["paddingLeft", 15], ["backgroundColor", "#f8f8f8"]])]])], ["uni-header-logo", new Map<string, any>([["", new Map<string, any>([["display", "flex"], ["paddingTop", 15], ["paddingRight", 15], ["paddingBottom", 15], ["paddingLeft", 15], ["flexDirection", "column"], ["justifyContent", "center"], ["alignItems", "center"], ["marginTop", "10rpx"]])]])], ["uni-header-image", new Map<string, any>([["", new Map<string, any>([["width", 80], ["height", 80]])]])], ["uni-hello-text", new Map<string, any>([["", new Map<string, any>([["marginBottom", 20], ["color", "#7A7E83"]])]])], ["hello-text", new Map<string, any>([["", new Map<string, any>([["color", "#7A7E83"], ["fontSize", 14], ["lineHeight", 20]])]])], ["hello-link", new Map<string, any>([["", new Map<string, any>([["color", "#7A7E83"], ["fontSize", 14], ["lineHeight", 20]])]])], ["uni-panel", new Map<string, any>([["", new Map<string, any>([["marginBottom", 12]])]])], ["text-disabled", new Map<string, any>([["", new Map<string, any>([["color", "#a0a0a0"]])]])], ["uni-panel-h", new Map<string, any>([["", new Map<string, any>([["display", "flex"], ["backgroundColor", "#ffffff"], ["!flexDirection", "row"], ["!justifyContent", "space-between"], ["!alignItems", "center"], ["paddingTop", 12], ["paddingRight", 12], ["paddingBottom", 12], ["paddingLeft", 12]])]])], ["uni-panel-h-on", new Map<string, any>([["", new Map<string, any>([["backgroundColor", "#f0f0f0"]])]])], ["uni-panel-text", new Map<string, any>([["", new Map<string, any>([["color", "#000000"], ["fontSize", 14], ["fontWeight", "normal"]])]])], ["uni-panel-icon", new Map<string, any>([["", new Map<string, any>([["marginLeft", 15], ["color", "#999999"], ["fontSize", 14], ["fontWeight", "normal"], ["transform", "rotate(0deg)"], ["transitionDuration", 0], ["transitionProperty", "transform"]])]])], ["uni-panel-icon-on", new Map<string, any>([["", new Map<string, any>([["transform", "rotate(180deg)"]])]])], ["uni-navigate-item", new Map<string, any>([["", new Map<string, any>([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"], ["backgroundColor", "#FFFFFF"], ["borderTopStyle", "solid"], ["borderTopColor", "#f0f0f0"], ["borderTopWidth", 1], ["paddingTop", 12], ["paddingRight", 12], ["paddingBottom", 12], ["paddingLeft", 12], ["justifyContent", "space-between"], ["backgroundColor:active", "#f8f8f8"]])]])], ["uni-navigate-text", new Map<string, any>([["", new Map<string, any>([["color", "#000000"], ["fontSize", 14], ["fontWeight", "normal"]])]])], ["uni-navigate-icon", new Map<string, any>([["", new Map<string, any>([["marginLeft", 15], ["color", "#999999"], ["fontSize", 14], ["fontWeight", "normal"]])]])], ["arrow", new Map<string, any>([["", new Map<string, any>([["width", 8], ["height", 8], ["borderTopWidth", 2], ["borderTopStyle", "solid"], ["borderTopColor", "#cccccc"], ["borderLeftWidth", 2], ["borderLeftStyle", "solid"], ["borderLeftColor", "#cccccc"]])]])], ["arrow-right", new Map<string, any>([["", new Map<string, any>([["transform", "rotate(135deg)"]])]])], ["arrow-up", new Map<string, any>([["", new Map<string, any>([["transform", "rotate(45deg)"]])]])], ["arrow-down", new Map<string, any>([["", new Map<string, any>([["transform", "rotate(-135deg)"]])]])], ["@TRANSITION", new Map<string, any>([["uni-panel-icon", new Map<string, any>([["duration", 0], ["property", "transform"]])]])]])]
Y
yurj26 已提交
460
import _easycom_u_link from '/Users/yuanrenjie/Documents/dcloud/hello-uniapp x/unpackage/dist/dev/.uvue/components/u-link/u-link.vue'
Y
init  
yurj26 已提交
461
@Suppress("UNUSED_PARAMETER") function GenPagesTabBarAPIAPIRender(_ctx: GenPagesTabBarAPIAPI): VNode | null {
Y
yurj26 已提交
462
const _component_u_link = resolveEasyComponent("u-link",_easycom_u_link)
Y
init  
yurj26 已提交
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521

  return createElementVNode("view", new Map<string, any | null>([["class", "uni-container"]]), [
    createElementVNode("view", new Map<string, any | null>([["class", "uni-header-logo"]]), [
      createElementVNode("image", new Map<string, any | null>([
        ["class", "uni-header-image"],
        ["src", "/static/apiIndex.png"]
      ]))
    ]),
    createElementVNode("view", new Map<string, any | null>([["class", "uni-hello-text"]]), [
      createElementVNode("text", new Map<string, any | null>([["class", "hello-text"]]), "以下将演示uni-app接口能力,详细文档见:"),
      createVNode(_component_u_link, new Map<string, any | null>([
        ["href", 'https://uniapp.dcloud.io/api/'],
        ["text", 'https://uniapp.dcloud.io/api/'],
        ["inWhiteList", true]
      ]), null, 8 /* PROPS */, ["href", "text"])
    ]),
    createElementVNode(Fragment, null, RenderHelpers.renderList(_ctx.list, (item, index, _):VNode => {
      return createElementVNode("view", new Map<string, any | null>([
        ["class", "uni-panel"],
        ["key", item.id]
      ]), [
        createElementVNode("view", new Map<string, any | null>([
          ["class", normalizeClass(["uni-panel-h", item.open ? 'uni-panel-h-on' : ''])],
          ["onClick", () => {_ctx.triggerCollapse(index, item)}]
        ]), [
          createElementVNode("text", new Map<string, any | null>([
            ["class", normalizeClass(["uni-panel-text", item.enable == false ? 'text-disabled' : ''])]
          ]), toDisplayString(item.name), 3 /* TEXT, CLASS */),
          createElementVNode("image", new Map<string, any | null>([
            ["src", item.pages.length > 0 ? item.open ? _ctx.arrowUpIcon : _ctx.arrowDownIcon : _ctx.arrowRightIcon],
            ["class", "uni-icon"]
          ]), null, 8 /* PROPS */, ["src"])
        ], 10 /* CLASS, PROPS */, ["onClick"]),
        isTrue(item.open)
          ? createElementVNode("view", new Map<string, any | null>([
              ["key", 0],
              ["class", "uni-panel-c"]
            ]), [
              createElementVNode(Fragment, null, RenderHelpers.renderList(item.pages, (page, key, _):VNode => {
                return createElementVNode("view", new Map<string, any | null>([
                  ["class", "uni-navigate-item"],
                  ["key", key],
                  ["onClick", () => {_ctx.goDetailPage(page)}]
                ]), [
                  createElementVNode("text", new Map<string, any | null>([
                    ["class", normalizeClass(["uni-navigate-text", page.enable != true ? 'text-disabled' : ''])]
                  ]), toDisplayString(page.name), 3 /* TEXT, CLASS */),
                  createElementVNode("image", new Map<string, any | null>([
                    ["src", _ctx.arrowRightIcon],
                    ["class", "uni-icon"]
                  ]), null, 8 /* PROPS */, ["src"])
                ], 8 /* PROPS */, ["onClick"])
              }), 128 /* KEYED_FRAGMENT */)
            ])
          : createCommentVNode("v-if", true)
      ])
    }), 128 /* KEYED_FRAGMENT */)
  ])
}