Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
8fe93144
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8fe93144
编写于
9月 26, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: onLoad 参数类型调整支持向下兼容
上级
3869946d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
73 deletion
+53
-73
pages/API/get-current-pages/get-current-pages.uvue
pages/API/get-current-pages/get-current-pages.uvue
+48
-68
pages/API/navigator/new-page/new-page-1.uvue
pages/API/navigator/new-page/new-page-1.uvue
+2
-2
pages/template/list-news/detail/detail.uvue
pages/template/list-news/detail/detail.uvue
+3
-3
未找到文件。
pages/API/get-current-pages/get-current-pages.uvue
浏览文件 @
8fe93144
<template>
<template>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
<scroll-view class="page-scroll-view">
<scroll-view class="page-scroll-view">
<!-- #endif -->
<!-- #endif -->
<view>
<view>
<page-head title="getCurrentPages"></page-head>
<page-head title="getCurrentPages"></page-head>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
...
@@ -9,9 +9,7 @@
...
@@ -9,9 +9,7 @@
<view v-if="pages.length" style="padding: 15px 0px">
<view v-if="pages.length" style="padding: 15px 0px">
<text>当前页面栈中 {{ pages.length }} 个页面,列表如下:</text>
<text>当前页面栈中 {{ pages.length }} 个页面,列表如下:</text>
<template v-for="(page, index) in pages" :key="page.route">
<template v-for="(page, index) in pages" :key="page.route">
<text style="margin-top: 5px"
<text style="margin-top: 5px">index: {{ index }}, route: {{ page.route }}</text>
>index: {{ index }}, route: {{ page.route }}</text
>
</template>
</template>
</view>
</view>
<button class="uni-common-mt" @click="check$page">check $page</button>
<button class="uni-common-mt" @click="check$page">check $page</button>
...
@@ -21,11 +19,7 @@
...
@@ -21,11 +19,7 @@
<button class="uni-common-mt" @click="checkGetDialogPages">
<button class="uni-common-mt" @click="checkGetDialogPages">
check getDialogPages
check getDialogPages
</button>
</button>
<button
<button id="check-get-element-by-id-btn" class="uni-common-mt" @click="checkGetElementById">
id="check-get-element-by-id-btn"
class="uni-common-mt"
@click="checkGetElementById"
>
check getElementById
check getElementById
</button>
</button>
<button class="uni-common-mt" @click="checkGetAndroidView">
<button class="uni-common-mt" @click="checkGetAndroidView">
...
@@ -35,11 +29,7 @@
...
@@ -35,11 +29,7 @@
<page-head title="currentPageStyle"></page-head>
<page-head title="currentPageStyle"></page-head>
<template v-for="(item, index) in PageStyleArray">
<template v-for="(item, index) in PageStyleArray">
<view
<view class="page-style-item" v-if="currentPageStyle[item.key] != null" :key="index">
class="page-style-item"
v-if="currentPageStyle[item.key] != null"
:key="index"
>
<view class="item-text">
<view class="item-text">
<text class="item-text-key">{{ item.key }}:</text>
<text class="item-text-key">{{ item.key }}:</text>
<text class="item-text-value">{{
<text class="item-text-value">{{
...
@@ -47,30 +37,17 @@
...
@@ -47,30 +37,17 @@
}}</text>
}}</text>
</view>
</view>
<view class="set-value" v-if="item.type == 'boolean'">
<view class="set-value" v-if="item.type == 'boolean'">
<switch
<switch :checked="currentPageStyle.getBoolean(item.key)"
:checked="currentPageStyle.getBoolean(item.key)"
@change="switchChange(item.key, $event as UniSwitchChangeEvent)">
@change="switchChange(item.key, $event as UniSwitchChangeEvent)"
>
</switch>
</switch>
</view>
</view>
<view class="set-value" v-else-if="item.type == 'number'">
<view class="set-value" v-else-if="item.type == 'number'">
<slider
<slider :value="currentPageStyle.getNumber(item.key)" :show-value="true"
:value="currentPageStyle.getNumber(item.key)"
@change="sliderChange(item.key, $event as UniSliderChangeEvent)" />
:show-value="true"
@change="sliderChange(item.key, $event as UniSliderChangeEvent)"
/>
</view>
</view>
<view class="set-value" v-else-if="item.type == 'string'">
<view class="set-value" v-else-if="item.type == 'string'">
<radio-group
<radio-group class="radio-set-value" @change="radioChange(item.key, $event as RadioGroupChangeEvent)">
class="radio-set-value"
<radio class="radio-value" v-for="(item2, index2) in item.value" :key="index2" :value="item2">{{ item2 }}
@change="radioChange(item.key, $event as RadioGroupChangeEvent)"
>
<radio
class="radio-value"
v-for="(item2, index2) in item.value"
:key="index2"
:value="item2"
>{{ item2 }}
</radio>
</radio>
</radio-group>
</radio-group>
</view>
</view>
...
@@ -80,7 +57,7 @@
...
@@ -80,7 +57,7 @@
go set disable pullDownRefresh
go set disable pullDownRefresh
</button>
</button>
</view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
</scroll-view>
</scroll-view>
<!-- #endif -->
<!-- #endif -->
</template>
</template>
...
@@ -108,7 +85,10 @@
...
@@ -108,7 +85,10 @@
return JSON.stringify(this.currentPageStyle)
return JSON.stringify(this.currentPageStyle)
}
}
},
},
onLoad() {
onLoad(options : OnLoadOptions) {
if (options instanceof UTSJSONObject) {
this.checked = true
}
this.getPageStyle();
this.getPageStyle();
},
},
onPullDownRefresh() {
onPullDownRefresh() {
...
@@ -124,7 +104,7 @@
...
@@ -124,7 +104,7 @@
this.pages.length = 0
this.pages.length = 0
const pages = getCurrentPages()
const pages = getCurrentPages()
this.pages.push(new Page(pages[0].route))
this.pages.push(new Page(pages[0].route))
if (this.
pages[0].route.includes('/tabBar/') || this.pages[0].route == '/'
) {
if (this.
checked && (this.pages[0].route.includes('/tabBar/') || this.pages[0].route == '/')
) {
this.checked = true
this.checked = true
}
}
for (let i = 1; i < pages.length; i++) {
for (let i = 1; i < pages.length; i++) {
...
@@ -175,7 +155,7 @@
...
@@ -175,7 +155,7 @@
const page = this.getCurrentPage()
const page = this.getCurrentPage()
let res = this.$page === page
let res = this.$page === page
if (this.testing && res) {
if (this.testing && res) {
res = page.options
.get('test')
== '123'
res = page.options
['test']
== '123'
if (res) {
if (res) {
// #ifdef WEB
// #ifdef WEB
res = page.route == '/pages/API/get-current-pages/get-current-pages'
res = page.route == '/pages/API/get-current-pages/get-current-pages'
...
@@ -233,43 +213,43 @@
...
@@ -233,43 +213,43 @@
</script>
</script>
<style>
<style>
.page {
.page {
flex: 1;
flex: 1;
padding: 10px;
padding: 10px;
}
}
.page-style {
.page-style {
margin-top: 15px;
margin-top: 15px;
}
}
.page-style-item {
.page-style-item {
padding: 10px;
padding: 10px;
margin-top: 10px;
margin-top: 10px;
background-color: #ffffff;
background-color: #ffffff;
border-radius: 5px;
border-radius: 5px;
}
}
.item-text {
.item-text {
flex-direction: row;
flex-direction: row;
}
}
.item-text-key {
.item-text-key {
font-weight: bold;
font-weight: bold;
}
}
.item-text-value {
.item-text-value {
margin-left: 5px;
margin-left: 5px;
}
}
.set-value {
.set-value {
margin-top: 10px;
margin-top: 10px;
}
}
.radio-set-value {
.radio-set-value {
flex-direction: row;
flex-direction: row;
}
}
.radio-value {
.radio-value {
margin-left: 10px;
margin-left: 10px;
}
}
</style>
</style>
pages/API/navigator/new-page/new-page-1.uvue
浏览文件 @
8fe93144
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
},
},
onLoad(options : OnLoadOptions) {
onLoad(options : OnLoadOptions) {
if (options['data'] != null) {
if (options['data'] != null) {
this.data = options['data']
as string
this.data = options['data']
!
}
}
},
},
methods: {
methods: {
...
@@ -46,4 +46,4 @@
...
@@ -46,4 +46,4 @@
}
}
},
},
}
}
</script>
</script>
pages/template/list-news/detail/detail.uvue
浏览文件 @
8fe93144
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
}
}
},
},
onLoad(event : OnLoadOptions) {
onLoad(event : OnLoadOptions) {
this.post_id = event["post_id"]
as string
?? "";
this.post_id = event["post_id"] ?? "";
this.cover = event["cover"]
as string
?? "";
this.cover = event["cover"] ?? "";
this.title = event["title"]
as string
?? "";
this.title = event["title"] ?? "";
this.getDetail();
this.getDetail();
},
},
methods: {
methods: {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录