Skip to content

Commit 4f6a150

Browse files
committed
update: input页面改为nvue, mp-alipay开放video页面
1 parent ad9901e commit 4f6a150

4 files changed

Lines changed: 245 additions & 148 deletions

File tree

‎pages.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,12 @@
217217
"navigationBarTitleText": "image"
218218
}
219219
},
220-
// #ifndef MP-ALIPAY
221220
{
222221
"path": "pages/component/video/video",
223222
"style": {
224223
"navigationBarTitleText": "video"
225224
}
226225
},
227-
// #endif
228226
// #ifndef MP-ALIPAY || MP-TOUTIAO
229227
{
230228
"path": "pages/component/audio/audio",

‎pages/component/input/input.nvue‎

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
<template>
2+
<view class="nvue-page-root">
3+
<view class="page-title">
4+
<view class="page-title__wrapper">
5+
<text class="page-title__text">{{title}}</text>
6+
</view>
7+
</view>
8+
<view class="uni-common-mt">
9+
<view class="uni-form-item uni-column">
10+
<view class="title"><text class="uni-form-item__title">可自动聚焦的 input</text></view>
11+
<view class="uni-input-wrapper">
12+
<input class="uni-input" focus placeholder="自动获得焦点" />
13+
</view>
14+
</view>
15+
<!-- #ifdef APP-PLUS -->
16+
<view v-if="platform==='ios'" class="uni-form-item uni-column">
17+
<view class="title"><text class="uni-form-item__title">隐藏 iOS 软键盘上的导航条</text></view>
18+
<view class="uni-input-wrapper">
19+
<input class="uni-input" placeholder="触摸其他地方收起键盘" @focus="onFocus" @blur="onBlur" />
20+
</view>
21+
</view>
22+
<!-- #endif -->
23+
<view class="uni-form-item uni-column">
24+
<view class="title"><text class="uni-form-item__title">键盘右下角按钮显示为搜索</text></view>
25+
<view class="uni-input-wrapper">
26+
<input class="uni-input" confirm-type="search" placeholder="键盘右下角按钮显示为搜索" />
27+
</view>
28+
</view>
29+
<view class="uni-form-item uni-column">
30+
<view class="title"><text class="uni-form-item__title">键盘右下角按钮显示为发送</text></view>
31+
<view class="uni-input-wrapper">
32+
<input class="uni-input" confirm-type="send" placeholder="键盘右下角按钮显示为发送" />
33+
</view>
34+
</view>
35+
<view class="uni-form-item uni-column">
36+
<view class="title"><text class="uni-form-item__title">控制最大输入长度的 input</text></view>
37+
<view class="uni-input-wrapper">
38+
<input class="uni-input" maxlength="10" placeholder="最大输入长度为10" />
39+
</view>
40+
</view>
41+
<view class="uni-form-item uni-column">
42+
<view class="title"><text class="uni-form-item__title">实时获取输入值:{{inputValue}}</text></view>
43+
<view class="uni-input-wrapper">
44+
<input class="uni-input" @input="onKeyInput" placeholder="输入同步到view中" />
45+
</view>
46+
</view>
47+
<view class="uni-form-item uni-column">
48+
<view class="title"><text class="uni-form-item__title">控制输入的 input</text></view>
49+
<view class="uni-input-wrapper">
50+
<input class="uni-input" @input="replaceInput" v-model="changeValue" placeholder="连续的两个1会变成2" />
51+
</view>
52+
</view>
53+
<!-- #ifndef MP-BAIDU -->
54+
<view class="uni-form-item uni-column">
55+
<view class="title"><text class="uni-form-item__title">控制键盘的 input</text></view>
56+
<view class="uni-input-wrapper">
57+
<input class="uni-input" ref="input1" @input="hideKeyboard" placeholder="输入123自动收起键盘" />
58+
</view>
59+
</view>
60+
<!-- #endif -->
61+
<view class="uni-form-item uni-column">
62+
<view class="title"><text class="uni-form-item__title">数字输入的 input</text></view>
63+
<view class="uni-input-wrapper">
64+
<input class="uni-input" type="number" placeholder="这是一个数字输入框" />
65+
</view>
66+
</view>
67+
<view class="uni-form-item uni-column">
68+
<view class="title"><text class="uni-form-item__title">密码输入的 input</text></view>
69+
<view class="uni-input-wrapper">
70+
<input class="uni-input" password type="text" placeholder="这是一个密码输入框" />
71+
</view>
72+
</view>
73+
<view class="uni-form-item uni-column">
74+
<view class="title"><text class="uni-form-item__title">带小数点的 input</text></view>
75+
<view class="uni-input-wrapper">
76+
<input class="uni-input" type="digit" placeholder="带小数点的数字键盘" /> </view>
77+
</view>
78+
<view class="uni-form-item uni-column">
79+
<view class="title"><text class="uni-form-item__title">身份证输入的 input</text></view>
80+
<view class="uni-input-wrapper">
81+
<input class="uni-input" type="idcard" placeholder="身份证输入键盘" /> </view>
82+
</view>
83+
<view class="uni-form-item uni-column">
84+
<view class="title"><text class="uni-form-item__title">控制占位符颜色的 input</text></view>
85+
<view class="uni-input-wrapper">
86+
<input class="uni-input" placeholder-style="color:#F76260" placeholder="占位符字体是红色的" />
87+
</view>
88+
</view>
89+
<view class="uni-form-item uni-column">
90+
<view class="title"><text class="uni-form-item__title">带清除按钮的输入框</text></view>
91+
<view class="uni-input-wrapper">
92+
<input class="uni-input" placeholder="带清除按钮的输入框" :value="inputClearValue" @input="clearInput" />
93+
<text class="uni-icon" v-if="showClearIcon" @click="clearIcon">&#xe434;</text>
94+
</view>
95+
</view>
96+
<!-- #ifndef APP-NVUE -->
97+
<view class="uni-form-item uni-column">
98+
<view class="title"><text class="uni-form-item__title">可查看密码的输入框</text></view>
99+
<view class="uni-input-wrapper">
100+
<input class="uni-input" placeholder="请输入密码" :password="showPassword" />
101+
<text class="uni-icon" :class="[!showPassword ? 'uni-eye-active' : '']" @click="changePassword">&#xe568;</text>
102+
</view>
103+
</view>
104+
<!-- #endif -->
105+
</view>
106+
</view>
107+
</template>
108+
<script>
109+
import pageHead from '@/components/page-head.vue'
110+
export default {
111+
components: {
112+
pageHead
113+
},
114+
data() {
115+
return {
116+
title: 'input',
117+
focus: false,
118+
inputValue: '',
119+
showClearIcon: false,
120+
inputClearValue: '',
121+
changeValue: '',
122+
showPassword: true,
123+
src: '../../../static/eye-1.png',
124+
platform: ''
125+
}
126+
},
127+
methods: {
128+
onKeyInput: function(event) {
129+
this.inputValue = event.target.value
130+
},
131+
replaceInput: function(event) {
132+
var value = event.target.value;
133+
if (value === '11') {
134+
this.changeValue = '2';
135+
}
136+
},
137+
hideKeyboard: function(event) {
138+
if (event.target.value === '123') {
139+
uni.hideKeyboard();
140+
}
141+
},
142+
clearInput: function(event) {
143+
this.inputClearValue = event.target.value;
144+
if (event.detail.value.length > 0) {
145+
this.showClearIcon = true;
146+
} else {
147+
this.showClearIcon = false;
148+
}
149+
},
150+
clearIcon: function() {
151+
this.inputClearValue = '';
152+
this.showClearIcon = false;
153+
},
154+
changePassword: function() {
155+
this.showPassword = !this.showPassword;
156+
},
157+
onFocus() {
158+
this.$mp.page.$getAppWebview().setStyle({
159+
softinputNavBar: 'none'
160+
})
161+
},
162+
onBlur() {
163+
this.$mp.page.$getAppWebview().setStyle({
164+
softinputNavBar: 'auto'
165+
})
166+
}
167+
},
168+
onLoad() {
169+
this.platform = uni.getSystemInfoSync().platform
170+
}
171+
}
172+
</script>
173+
174+
<style scoped>
175+
.nvue-page-root {
176+
background-color: #F8F8F8;
177+
padding-bottom: 20px;
178+
}
179+
180+
.page-title {
181+
/* #ifndef APP-NVUE */
182+
display: flex;
183+
/* #endif */
184+
flex-direction: row;
185+
justify-content: center;
186+
align-items: center;
187+
padding: 35rpx;
188+
}
189+
190+
.page-title__wrapper {
191+
padding: 0px 20px;
192+
border-bottom-color: #D8D8D8;
193+
border-bottom-width: 1px;
194+
}
195+
196+
.page-title__text {
197+
font-size: 16px;
198+
height: 48px;
199+
line-height: 48px;
200+
color: #BEBEBE;
201+
}
202+
203+
.title {
204+
padding: 5px 13px;
205+
}
206+
207+
.uni-form-item__title {
208+
font-size: 16px;
209+
line-height: 24px;
210+
}
211+
212+
.uni-input-wrapper {
213+
/* #ifndef APP-NVUE */
214+
display: flex;
215+
/* #endif */
216+
padding: 8px 13px;
217+
flex-direction: row;
218+
flex-wrap: nowrap;
219+
background-color: #FFFFFF;
220+
}
221+
222+
.uni-input {
223+
height: 28px;
224+
line-height: 28px;
225+
font-size: 15px;
226+
padding: 0px;
227+
flex: 1;
228+
background-color: #FFFFFF;
229+
}
230+
231+
.uni-icon {
232+
font-family: uniicons;
233+
font-size: 24px;
234+
font-weight: normal;
235+
font-style: normal;
236+
width: 24px;
237+
height: 24px;
238+
line-height: 24px;
239+
color: #999999;
240+
}
241+
242+
.uni-eye-active {
243+
color: #007AFF;
244+
}
245+
</style>

0 commit comments

Comments
 (0)