提交 4121ced3 编写于 作者: W wanganxp

补充软键盘上推页面的测试

上级 33093bf9
......@@ -46,6 +46,8 @@
<input type="file" />
<p style="font-size: 14px;">&lt;input type="file" accept="image/*" multiple /&gt;</p>
<input type="file" accept="image/*" multiple />
<p style="font-size: 14px;">普通input</p>
<input placeholder="底部输入框"/>
</div>
<!-- uni 的 SDK -->
<script type="text/javascript" src="uni.webview.1.5.5.js"></script>
......
<template>
<view class="content">
<uni-navbar-lite :title="title" :is-left="isLeft" :text-color="navigationBarTextColor"></uni-navbar-lite>
<scroll-view class="scroll-view" scroll-y="true">
<view class="content-item" @click="onClick">
<text>点击此处,将标题切换为{{isLeft?'居中':'左侧'}}显示</text>
</view>
<view class="content-item" @tap="setNavigationBarColor1">
<text>设置自定义导航栏前景色白色</text>
</view>
<view class="content-item" @tap="setNavigationBarColor2">
<text>设置自定义导航栏前景色黑色</text>
</view>
<view class="content-item" v-for="item in 20">
<view class="cell-item">
<text class="text">内容:{{item}}</text>
<input class="text" style="margin-top: 8px;" placeholder="备注:"/>
<view class="content-item" @click="onClick">
<text>点击此处,将标题切换为{{isLeft?'居中':'左侧'}}显示</text>
</view>
<view class="content-item" @tap="setNavigationBarColor1">
<text>设置自定义导航栏前景色白色</text>
</view>
<view class="content-item" @tap="setNavigationBarColor2">
<text>设置自定义导航栏前景色黑色</text>
</view>
<view style="align-items: center;height: 60px;">
<text>测试输入框上推页面</text>
<radio-group @change="ChangeView" style="flex-direction: row;">
<radio value="0" :checked="true"><text>scroll-view</text></radio>
<radio value="1"><text>list-view</text></radio>
<radio value="2"><text>web-view</text></radio>
</radio-group>
</view>
<scroll-view v-if="indexView==0" class="scroll-view">
<view class="content-item" v-for="item in 10">
<view class="cell-item">
<text class="text">内容:{{item}}</text>
<input class="text" style="margin-top: 8px;" placeholder="备注输入框:" />
</view>
</view>
<!-- <input/> -->
</view>
</scroll-view>
<list-view v-if="indexView==1" class="scroll-view">
<list-item class="content-item" v-for="item in 10">
<view class="cell-item">
<text class="text">列表项内容:{{item}}</text>
<input class="text" style="margin-top: 8px;" placeholder="备注输入框:" />
</view>
</list-item>
</list-view>
<web-view v-if="indexView==2" src="/hybrid/html/local.html" id="webv" style="height:380px"></web-view>
<view style="position: relative;bottom: 0;">
<input placeholder="滚动视图外的居底输入框" adjust-position="true" />
</view>
</view>
</template>
<script>
<script>
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
data() {
return {
title: 'Hello uni-app',
isLeft: false,
navigationBarTextColor: '#000'
isLeft: false,
navigationBarTextColor: '#000',
indexView: 0
}
},
methods: {
onClick(){
this.isLeft = !this.isLeft
},
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#0000',
success: () => {
this.navigationBarTextColor = '#fff'
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#0000',
success: () => {
this.navigationBarTextColor = '#000'
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
// 自动化测试
getLifeCycleNum(): number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num: number) {
setLifeCycleNum(num)
methods: {
onClick() {
this.isLeft = !this.isLeft
},
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#0000',
success: () => {
this.navigationBarTextColor = '#fff'
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#0000',
success: () => {
this.navigationBarTextColor = '#000'
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
ChangeView(e:UniRadioGroupChangeEvent){
this.indexView = parseInt(e.detail.value)
},
// 自动化测试
getLifeCycleNum() : number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
},
}
}
</script>
......@@ -108,11 +129,11 @@
margin: 5px 10px;
background-color: #fff;
border-radius: 5px;
}
.cell-item {
display: flex;
flex-direction: column;
}
.cell-item {
display: flex;
flex-direction: column;
}
.text {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册