Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
ff75f65c
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看板
提交
ff75f65c
编写于
7月 01, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
http://git.dcloud.io/uni-app-x/hello-uniapp-x
into master
上级
8d6894ef
914b6497
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
646 addition
and
310 deletion
+646
-310
pages.json
pages.json
+41
-18
pages/API/download-file/download-file.uvue
pages/API/download-file/download-file.uvue
+46
-29
pages/API/request/request.uvue
pages/API/request/request.uvue
+54
-39
pages/API/upload-file/upload-file.uvue
pages/API/upload-file/upload-file.uvue
+33
-15
pages/API/websocket-global/websocket-global.uvue
pages/API/websocket-global/websocket-global.uvue
+164
-151
pages/API/websocket-socketTask/websocket-socketTask.uvue
pages/API/websocket-socketTask/websocket-socketTask.uvue
+43
-32
pages/component/list/list.uvue
pages/component/list/list.uvue
+87
-0
pages/component/scroll-view/scroll-view-refresher.uvue
pages/component/scroll-view/scroll-view-refresher.uvue
+80
-0
pages/component/scroll-view/scroll-view.uvue
pages/component/scroll-view/scroll-view.uvue
+16
-3
pages/component/slider-100/slider-100.uvue
pages/component/slider-100/slider-100.uvue
+48
-0
pages/component/web-view-local/web-view-local.uvue
pages/component/web-view-local/web-view-local.uvue
+13
-11
pages/component/web-view/web-view.uvue
pages/component/web-view/web-view.uvue
+13
-11
pages/tabBar/component/component.uvue
pages/tabBar/component/component.uvue
+8
-1
未找到文件。
pages.json
浏览文件 @
ff75f65c
...
@@ -67,6 +67,12 @@
...
@@ -67,6 +67,12 @@
"navigationBarTitleText"
:
"slider"
"navigationBarTitleText"
:
"slider"
}
}
},
},
{
"path"
:
"pages/component/slider-100/slider-100"
,
"style"
:
{
"navigationBarTitleText"
:
"slider x 100"
}
},
{
{
"path"
:
"pages/component/switch/switch"
,
"path"
:
"pages/component/switch/switch"
,
"style"
:
{
"style"
:
{
...
@@ -84,24 +90,24 @@
...
@@ -84,24 +90,24 @@
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"image"
"navigationBarTitleText"
:
"image"
}
}
},
},
{
{
"path"
:
"pages/component/image/image-format"
,
"path"
:
"pages/component/image/image-format"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"image-format"
"navigationBarTitleText"
:
"image-format"
}
}
},
},
{
{
"path"
:
"pages/component/image/image-mode"
,
"path"
:
"pages/component/image/image-mode"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"image-mode"
"navigationBarTitleText"
:
"image-mode"
}
}
},
},
{
{
"path"
:
"pages/component/image/image-path"
,
"path"
:
"pages/component/image/image-path"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"image-path"
"navigationBarTitleText"
:
"image-path"
}
}
},
},
{
{
"path"
:
"pages/component/web-view/web-view"
,
"path"
:
"pages/component/web-view/web-view"
,
...
@@ -521,6 +527,23 @@
...
@@ -521,6 +527,23 @@
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
{
"path"
:
"pages/component/scroll-view/scroll-view-refresher"
,
"style"
:
{
"navigationBarTitleText"
:
"scroll-view-refresher"
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"pages/component/list/list"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
...
...
pages/API/download-file/download-file.uvue
浏览文件 @
ff75f65c
<template>
<template>
<view>
<view>
<page-head :title="title"></page-head>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-padding-wrap uni-common-mt">
<view v-if="imageSrc" class="image-container">
<view v-if="imageSrc" class="image-container">
<image class="img" :src="imageSrc" mode="center" />
<image class="img" :src="imageSrc" mode="center" />
</view>
</view>
<view v-else style="margin-top: 50px;">
<view v-else style="margin-top: 50px;">
...
@@ -17,35 +17,51 @@
...
@@ -17,35 +17,51 @@
</view>
</view>
</template>
</template>
<script>
<script>
import DownloadTask from 'uts.sdk.modules.DCloudUniNetwork.DownloadTask';
export default {
export default {
data() {
data() {
return {
return {
title: 'downloadFile',
title: 'downloadFile',
imageSrc: ''
imageSrc: '',
task: null as DownloadTask | null,
pageVisible: false
}
}
},
},
onLoad() {
this.pageVisible = true;
},
onUnload() {
onUnload() {
this.imageSrc = '';
this.imageSrc = '';
this.pageVisible = false;
uni.hideLoading();
this.task?.abort();
},
},
methods: {
methods: {
downloadImage: function
() {
downloadImage: function() {
uni.showLoading({
uni.showLoading({
title:'下载中'
title:
'下载中'
})
})
var self = this
var self = this
let task = uni.downloadFile({
this.task = uni.downloadFile({
url: "http://192.168.12.106:8080/downloadfile",
url: "https://web-assets.dcloud.net.cn/unidoc/zh/uni-app.png",
success(res) {
success(res) {
console.log('downloadFile success, res is', res)
if (this.pageVisible) {
self.imageSrc = res.tempFilePath;
console.log('downloadFile success, res is', res)
uni.hideLoading();
self.imageSrc = res.tempFilePath;
},
uni.hideLoading();
fail: (err) => {
}
console.log('downloadFile fail, err is:', err)
},
}
fail: (err) => {
});
if (this.pageVisible) {
task!.onProgressUpdate((update) => {
console.log('downloadFile fail, err is:', err)
console.log("progress : ", update.progress);
uni.hideLoading();
}
}
});
this.task?.onProgressUpdate((update) => {
if (this.pageVisible) {
console.log("progress : ", update.progress);
}
})
})
}
}
}
}
...
@@ -53,14 +69,15 @@
...
@@ -53,14 +69,15 @@
</script>
</script>
<style>
<style>
.img {
.img {
width: 500rpx;
width: 500rpx;
height: 500rpx;
height: 500rpx;
margin: 0 auto;
margin: 0 auto;
}
}
.image-container {
display: flex;
.image-container {
justify-content: center;
display: flex;
align-items: center;
justify-content: center;
}
align-items: center;
</style>
}
</style>
\ No newline at end of file
pages/API/request/request.uvue
浏览文件 @
ff75f65c
...
@@ -15,55 +15,70 @@
...
@@ -15,55 +15,70 @@
</view>
</view>
</template>
</template>
<script>
<script>
import RequestTask from 'uts.sdk.modules.DCloudUniNetwork.RequestTask';
const duration = 2000
const duration = 2000
export default {
export default {
data() {
data() {
return {
return {
title: 'request',
title: 'request',
loading: false,
loading: false,
res: ''
res: '',
task: null as RequestTask | null,
pageVisible: false
}
}
},
},
onLoad() {
this.pageVisible = true;
},
onUnload() {
this.pageVisible = false;
uni.hideLoading();
this.task?.abort();
},
methods: {
methods: {
sendRequest() {
sendRequest() {
this.loading = true;
this.loading = true;
uni.request({
this.task = uni.request({
url: "http://192.168.12.106:8080/postHalo",
url: "https://unidemo.dcloud.net.cn/ajax/echo/text?name=uni-app",
dataType: "json",
dataType: "json",
responseType: "json",
responseType: "json",
method: "POST",
method: "POST",
data: {
data: {
platform: "ios",
platform: "ios",
},
},
header: {
header: {
"Content-Type": "application/json",
"Content-Type": "application/json",
},
},
timeout: 6000,
timeout: 6000,
sslVerify: false,
sslVerify: false,
withCredentials: false,
withCredentials: false,
firstIpv4: false,
firstIpv4: false,
success(res) {
success(res) {
console.log('request success', res)
if (this.pageVisible) {
uni.showToast({
console.log('request success', res)
title: '请求成功',
uni.showToast({
icon: 'success',
title: '请求成功',
mask: true,
icon: 'success',
duration: duration
mask: true,
});
duration: duration
this.res = '请求结果 : ' + JSON.stringify(res);
});
},
this.res = '请求结果 : ' + JSON.stringify(res);
fail(err) {
}
console.log('request fail', err);
},
uni.showModal({
fail(err) {
content: err.errMsg,
if (this.pageVisible) {
showCancel: false
console.log('request fail', err);
});
uni.showModal({
},
content: err.errMsg,
complete() {
showCancel: false
this.loading = false;
});
},
}
});
},
complete() {
this.loading = false;
},
});
}
}
}
}
}
}
</script>
</script>
\ No newline at end of file
pages/API/upload-file/upload-file.uvue
浏览文件 @
ff75f65c
...
@@ -10,15 +10,24 @@
...
@@ -10,15 +10,24 @@
</view>
</view>
</template>
</template>
<script>
<script>
import UploadTask from 'uts.sdk.modules.DCloudUniNetwork.UploadTask';
export default {
export default {
data() {
data() {
return {
return {
title: 'uploadFile',
title: 'uploadFile',
imageSrc: ''
imageSrc: '',
task: null as UploadTask | null,
pageVisible: false
}
}
},
},
onLoad() {
this.pageVisible = true;
},
onUnload() {
onUnload() {
this.imageSrc = '';
this.imageSrc = '';
this.pageVisible = false;
uni.hideLoading();
this.task?.abort();
},
},
methods: {
methods: {
chooseImage: function() {
chooseImage: function() {
...
@@ -29,28 +38,37 @@
...
@@ -29,28 +38,37 @@
success: (res) => {
success: (res) => {
console.log('chooseImage success, temp path is', res.tempFilePaths[0])
console.log('chooseImage success, temp path is', res.tempFilePaths[0])
var imageSrc = res.tempFilePaths[0]
var imageSrc = res.tempFilePaths[0]
uni.uploadFile({
uni.showLoading({
url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
title: '上传中'
})
this.task = uni.uploadFile({
url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址
filePath: imageSrc,
filePath: imageSrc,
name: 'file',
name: 'file',
formData: {
formData: {
'user': 'test'
'user': 'test'
},
},
success: (res) => {
success: (res) => {
console.log('uploadImage success, res is:', res)
if (this.pageVisible) {
uni.showToast({
console.log('uploadImage success, res is:', res)
title: '上传成功',
uni.hideLoading();
icon: 'success',
uni.showToast({
duration: 1000
title: '上传成功',
})
icon: 'success',
this.imageSrc = imageSrc
duration: 1000
})
this.imageSrc = imageSrc
}
},
},
fail: (err) => {
fail: (err) => {
console.log('uploadImage fail', err);
if (this.pageVisible) {
uni.showModal({
console.log('uploadImage fail', err);
content: err.errMsg,
uni.hideLoading();
showCancel: false
uni.showModal({
});
content: err.errMsg,
showCancel: false
});
}
},
},
});
});
},
},
...
...
pages/API/websocket-global/websocket-global.uvue
浏览文件 @
ff75f65c
<template>
<template>
<view>
<view>
<page-head title="websocket通讯示例"></page-head>
<page-head title="websocket通讯示例"></page-head>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<view class="uni-btn-v">
<view class="websocket-msg">{{showMsg}}</view>
<view class="websocket-msg">{{showMsg}}</view>
<button class="uni-btn-v" type="primary" @click="connect">连接websocket服务</button>
<button class="uni-btn-v" type="primary" @click="connect">连接websocket服务</button>
<button class="uni-btn-v" v-show="connected" type="primary" @click="send">发送一条消息</button>
<button class="uni-btn-v" v-show="connected" type="primary" @click="send">发送一条消息</button>
<button class="uni-btn-v" type="primary" @click="close">断开websocket服务</button>
<button class="uni-btn-v" type="primary" @click="close">断开websocket服务</button>
<view class="websocket-tips">发送消息后会收到一条服务器返回的消息(与发送的消息内容一致)</view>
<view class="websocket-tips">发送消息后会收到一条服务器返回的消息(与发送的消息内容一致)</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
</template>
<script>
<script>
import CloseSocketOptions from 'uts.sdk.modules.DCloudUniWebsocket.CloseSocketOptions';
import CloseSocketOptions from 'uts.sdk.modules.DCloudUniWebsocket.CloseSocketOptions';
export default {
export default {
data() {
data() {
return {
return {
connected: false,
connected: false,
connecting: false,
connecting: false,
msg: "",
msg: "",
roomId: '',
roomId: '',
platform :"",
platform: "",
}
pageVisible: false
},
}
computed: {
},
showMsg():string {
computed: {
if (this.connected) {
showMsg(): string {
if (this.msg.length > 0) {
if (this.connected) {
return '收到消息:' + this.msg
if (this.msg.length > 0) {
} else {
return '收到消息:' + this.msg
return '等待接收消息'
} else {
}
return '等待接收消息'
} else {
}
return '尚未连接'
} else {
}
return '尚未连接'
}
}
},
}
onLoad() {
},
this.platform = uni.getSystemInfoSync().platform;
onLoad() {
},
this.platform = uni.getSystemInfoSync().platform;
this.pageVisible = true;
},
onUnload() {
onUnload() {
const closeOptions = new CloseSocketOptions();
this.pageVisible = false;
uni.closeSocket(closeOptions);
const closeOptions = new CloseSocketOptions();
uni.hideLoading()
uni.closeSocket(closeOptions);
},
uni.hideLoading()
methods: {
},
connect() {
methods: {
if (this.connected || this.connecting) {
connect() {
uni.showModal({
if (this.connected || this.connecting) {
content: '正在连接或者已经连接,请勿重复连接',
uni.showModal({
showCancel: false
content: '正在连接或者已经连接,请勿重复连接',
})
showCancel: false
return
})
}
return
this.connecting = true
}
uni.showLoading({
this.connecting = true
title: '连接中...'
uni.showLoading({
})
title: '连接中...'
uni.connectSocket({
})
url: 'ws://192.168.12.106:8080/ws',
uni.connectSocket({
success(res) {
url: 'ws://192.168.12.106:8080/ws',
// 这里是接口调用成功的回调,不是连接成功的回调,请注意
success(res) {
},
// 这里是接口调用成功的回调,不是连接成功的回调,请注意
fail(err) {
},
// 这里是接口调用失败的回调,不是连接失败的回调,请注意
fail(err) {
}
// 这里是接口调用失败的回调,不是连接失败的回调,请注意
})
}
uni.onSocketOpen((res) => {
})
this.connecting = false
uni.onSocketOpen((res) => {
this.connected = true
if (this.pageVisible) {
uni.hideLoading()
this.connecting = false
uni.showToast({
this.connected = true
icon: 'none',
uni.hideLoading()
title: '连接成功'
})
uni.showToast({
console.log('onOpen', res);
icon: 'none',
})
title: '连接成功'
uni.onSocketError((err) => {
})
this.connecting = false
console.log('onOpen', res);
this.connected = false
}
uni.hideLoading()
})
uni.showModal({
uni.onSocketError((err) => {
content: '连接失败,可能是websocket服务不可用,请稍后再试',
if (this.pageVisible) {
showCancel: false
this.connecting = false
})
this.connected = false
console.log('onError', err);
uni.hideLoading()
})
uni.onSocketMessage((res) => {
uni.showModal({
this.msg = res.data as string
content: '连接失败,可能是websocket服务不可用,请稍后再试',
console.log('onMessage', res)
showCancel: false
})
})
uni.onSocketClose((res) => {
console.log('onError', err);
this.connected = false
}
this.msg = ""
})
console.log('onClose', res)
uni.onSocketMessage((res) => {
})
if (this.pageVisible) {
},
this.msg = res.data as string
send() {
console.log('onMessage', res)
uni.sendSocketMessage({
}
data: 'from ' + platform + ' : ' + parseInt((Math.random() * 10000).toString()).toString(),
})
success(res) {
uni.onSocketClose((res) => {
console.log(res);
if (this.pageVisible) {
},
this.connected = false
fail(err) {
this.msg = ""
console.log(err);
console.log('onClose', res)
}
}
})
})
},
},
close() {
send() {
const closeSocketOptions = new CloseSocketOptions();
uni.sendSocketMessage({
uni.closeSocket(closeSocketOptions)
data: 'from ' + platform + ' : ' + parseInt((Math.random() * 10000).toString()).toString(),
}
success(res) {
}
console.log(res);
}
},
</script>
fail(err) {
console.log(err);
<style>
}
.uni-btn-v {
})
padding: 10rpx 0;
},
}
close() {
const closeSocketOptions = new CloseSocketOptions();
.uni-btn-v {
uni.closeSocket(closeSocketOptions)
margin: 20rpx 0;
}
}
}
}
.websocket-room {
</script>
height: 40px;
line-height: 40px;
<style>
text-align: center;
.uni-btn-v {
border-bottom: solid 1px #DDDDDD;
padding: 10rpx 0;
margin-bottom: 20px;
}
}
.uni-btn-v {
.websocket-msg {
margin: 20rpx 0;
padding: 40px 0px;
}
text-align: center;
font-size: 14px;
.websocket-room {
line-height: 40px;
height: 40px;
color: #666666;
line-height: 40px;
}
text-align: center;
border-bottom: solid 1px #DDDDDD;
.websocket-tips{
margin-bottom: 20px;
padding: 40px 0px;
}
text-align: center;
font-size: 14px;
.websocket-msg {
line-height: 24px;
padding: 40px 0px;
color: #666666;
text-align: center;
}
font-size: 14px;
</style>
line-height: 40px;
color: #666666;
}
.websocket-tips {
padding: 40px 0px;
text-align: center;
font-size: 14px;
line-height: 24px;
color: #666666;
}
</style>
\ No newline at end of file
pages/API/websocket-socketTask/websocket-socketTask.uvue
浏览文件 @
ff75f65c
...
@@ -24,8 +24,9 @@
...
@@ -24,8 +24,9 @@
connected: false,
connected: false,
connecting: false,
connecting: false,
socketTask: null as SocketTask | null,
socketTask: null as SocketTask | null,
msg: "",
msg: "",
platform :"",
platform: "",
pageVisible: false
}
}
},
},
computed: {
computed: {
...
@@ -40,14 +41,16 @@
...
@@ -40,14 +41,16 @@
return '尚未连接'
return '尚未连接'
}
}
}
}
},
},
onReady() {
onLoad() {
this.platform = uni.getSystemInfoSync().platform;
this.platform = uni.getSystemInfoSync().platform;
this.pageVisible = true;
},
},
onUnload() {
onUnload() {
this.pageVisible = false;
uni.hideLoading()
uni.hideLoading()
let task = this.socketTask;
let task = this.socketTask;
if (task != null) {
if (task != null) {
const closeOptions = new CloseSocketOptions();
const closeOptions = new CloseSocketOptions();
task.close(closeOptions)
task.close(closeOptions)
}
}
...
@@ -64,7 +67,7 @@
...
@@ -64,7 +67,7 @@
this.connecting = true
this.connecting = true
uni.showLoading({
uni.showLoading({
title: '连接中...'
title: '连接中...'
})
})
this.socketTask = uni.connectSocket({
this.socketTask = uni.connectSocket({
url: 'ws://192.168.12.106:8080/ws',
url: 'ws://192.168.12.106:8080/ws',
success(res) {
success(res) {
...
@@ -73,36 +76,44 @@
...
@@ -73,36 +76,44 @@
fail(err) {
fail(err) {
// 这里是接口调用失败的回调,不是连接失败的回调,请注意
// 这里是接口调用失败的回调,不是连接失败的回调,请注意
}
}
})
})
this.socketTask?.onOpen((res) => {
this.socketTask?.onOpen((res) => {
this.connecting = false
if (this.pageVisible) {
this.connected = true
this.connecting = false
uni.hideLoading()
this.connected = true
uni.showToast({
uni.hideLoading()
icon: 'none',
uni.showToast({
title: '连接成功'
icon: 'none',
})
title: '连接成功'
console.log('onOpen', res);
})
console.log('onOpen', res);
}
})
})
this.socketTask?.onError((err) => {
this.socketTask?.onError((err) => {
this.connecting = false
if (this.pageVisible) {
this.connected = false
this.connecting = false
uni.hideLoading()
this.connected = false
uni.showModal({
uni.hideLoading()
content: '连接失败,可能是websocket服务不可用,请稍后再试',
uni.showModal({
showCancel: false
content: '连接失败,可能是websocket服务不可用,请稍后再试',
})
showCancel: false
console.log('onError', err);
})
console.log('onError', err);
}
})
})
this.socketTask?.onMessage((res) => {
this.socketTask?.onMessage((res) => {
this.msg = res.data as string
if (this.pageVisible) {
console.log('onMessage', res)
this.msg = res.data as string
console.log('onMessage', res)
}
})
})
this.socketTask?.onClose((res) => {
this.socketTask?.onClose((res) => {
this.connected = false
if (this.pageVisible) {
this.socketTask = null
this.connected = false
this.msg = ""
this.socketTask = null
console.log('onClose', res)
this.msg = ""
console.log('onClose', res)
}
})
})
},
},
send() {
send() {
...
@@ -116,7 +127,7 @@
...
@@ -116,7 +127,7 @@
},
},
close() {
close() {
let task = this.socketTask;
let task = this.socketTask;
if (task != null) {
if (task != null) {
let closeOptions = new CloseSocketOptions();
let closeOptions = new CloseSocketOptions();
task.close(closeOptions)
task.close(closeOptions)
}
}
...
...
pages/component/list/list.uvue
0 → 100644
浏览文件 @
ff75f65c
<template>
<view style="height: 100%;width: 100%;">
<page-head :title="title"></page-head>
<view class="container">
<list class="uni-list" :refresher-enabled="true" @refresherrefresh="onRefresherrefresh"
:refresher-triggered="refresherTriggered">
<cell class="list_cell" v-for="(item, index) in dataList" :key="item.id">
<view class="list-item">
<text class="list-item-title" :value="item.name"></text>
</view>
</cell>
</list>
</view>
</view>
</template>
<script lang="ts">
import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent';
type Item = {
id : string,
name : string
}
export default {
data() {
return {
title: 'list',
refresherTriggered: false,
dataList: [] as Item[],
}
},
onLoad() {
for (var i = 0; i < 25; i++) {
const item : Item = { id: i + "", name: "item " + i }
this.dataList.push(item)
}
},
methods: {
onRefresherrefresh(e : RefresherEvent) {
this.refresherTriggered = true
setTimeout(function () {
this.refresherTriggered = false
}, 1000)
}
}
}
</script>
<style>
.uni-list {
background-color: #eee;
position: relative;
width: 100%;
flex: 1;
display: flex;
flex-direction: column;
border-color: red;
}
.container {
display: flex;
flex-direction: column;
border: dashed;
height: 100%;
width: 100%;
}
.list_cell{
display: flex;
justify-content: center;
align-items: center;
}
.list-item {
margin-left: 12px;
margin-right: 12px;
margin-top: 12px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
}
.list-item-title {
font-size: 30px;
font-weight: bold;
color: #444;
width: 100%;
}
</style>
\ No newline at end of file
pages/component/scroll-view/scroll-view-refresher.uvue
0 → 100644
浏览文件 @
ff75f65c
<template>
<view class="container">
<page-head title="scroll-view 下拉刷新"></page-head>
<scroll-view class="scroll" refresher-enabled = true @refresherrefresh="onRefresherrefresh" :refresher-triggered = "refresherTriggered">
<view v-for="key in scrollData" :key="key">
<view class="scroll-item">
<text class="scroll-item-title">{{key}}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent';
export default {
data() {
return {
scrollData: [] as Array <string>,
refresherTriggered: false
};
},
onLoad() {
let lists: Array < string > = []
for (let i = 0; i < 20; i++) {
lists.push("item---"+i)
}
this.scrollData = lists
},
methods: {
onRefresherrefresh(e: RefresherEvent) {
console.log("onRefresherrefresh--------------下拉刷新触发")
this.refresherTriggered = true
setTimeout(function(){
this.refresherTriggered = false
}, 1500)
}
}
};
</script>
<style>
.container{
display: flex;
flex-direction: column;
border:dashed;
flex: 1;
}
.scroll {
background-color: #eee;
position: relative;
width: 100%;
flex: 1;
display: flex;
flex-direction: column;
border-color: red;
}
.scroll-item {
margin-left: 12rpx;
margin-right: 12rpx;
margin-top: 12rpx;
background-color: #fff;
border-radius: 8rpx;
}
.scroll-item-title {
width:100%;
height: 120rpx;
line-height: 120rpx;
text-align: center;
color: #555;
}
</style>
\ No newline at end of file
pages/component/scroll-view/scroll-view.uvue
浏览文件 @
ff75f65c
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
<text class="uni-subtitle-text">纵向滚动</text>
<text class="uni-subtitle-text">纵向滚动</text>
</view>
</view>
<view>
<view>
<scroll-view :scrollTop="scrollTop" :scrollY="true" class="scroll-Y"
@scrolltoupper="upper
"
<scroll-view :scrollTop="scrollTop" :scrollY="true" class="scroll-Y"
scroll-with-animation="true
"
@scrolltolower="lower" @scroll="scroll">
@scrolltoupper="upper"
@scrolltolower="lower" @scroll="scroll">
<view id="demo1" class="scroll-view-item uni-bg-red"><text class="text">A</text></view>
<view id="demo1" class="scroll-view-item uni-bg-red"><text class="text">A</text></view>
<view id="demo2" class="scroll-view-item uni-bg-green"><text class="text">B</text></view>
<view id="demo2" class="scroll-view-item uni-bg-green"><text class="text">B</text></view>
<view id="demo3" class="scroll-view-item uni-bg-blue"><text class="text">C</text></view>
<view id="demo3" class="scroll-view-item uni-bg-blue"><text class="text">C</text></view>
...
@@ -18,6 +18,11 @@
...
@@ -18,6 +18,11 @@
<text class="uni-link">点击这里返回顶部</text>
<text class="uni-link">点击这里返回顶部</text>
</view>
</view>
<view class="uni-title uni-common-mt">
<text class="uni-subtitle-text">下拉刷新</text>
</view>
<button type="primary" class="button default-button" @click="gotoRefresher" size="mini">跳转"下拉刷新示例"</button>
<view class="uni-title uni-common-mt">
<view class="uni-title uni-common-mt">
<text class="uni-title-text">Horizontal Scroll</text>
<text class="uni-title-text">Horizontal Scroll</text>
<text class="uni-subtitle-text">横向滚动</text>
<text class="uni-subtitle-text">横向滚动</text>
...
@@ -61,7 +66,12 @@
...
@@ -61,7 +66,12 @@
icon: "none",
icon: "none",
title: "纵向滚动 scrollTop 值已被修改为 0"
title: "纵向滚动 scrollTop 值已被修改为 0"
})
})
}
},
gotoRefresher: function () {
uni.navigateTo({
url:"/pages/component/scroll-view/scroll-view-refresher"
})
}
}
}
}
}
</script>
</script>
...
@@ -93,4 +103,7 @@
...
@@ -93,4 +103,7 @@
font-size: 36rpx;
font-size: 36rpx;
color: #ffffff;
color: #ffffff;
}
}
.button {
margin-top: 30rpx;
}
</style>
</style>
\ No newline at end of file
pages/component/slider-100/slider-100.uvue
0 → 100644
浏览文件 @
ff75f65c
<template>
<view class="uni-padding-wrap">
<page-head :title="title"></page-head>
<view class="flex-row">
<view class="flex-fill">
<view v-for="(_, index1) in 33" :key="index1">
<slider @changing="sliderChanging" :value="sliderValue" :block-size="15" :show-value="true" />
</view>
</view>
<view class="flex-fill">
<view v-for="(_, index2) in 33" :key="index2">
<slider @changing="sliderChanging" :value="sliderValue" :block-size="15" :show-value="true" />
</view>
</view>
<view class="flex-fill">
<view v-for="(_, index3) in 33" :key="index3">
<slider @changing="sliderChanging" :value="sliderValue" :block-size="15" :show-value="true" />
</view>
</view>
</view>
</view>
</template>
<script lang="ts">
export default {
data() {
return {
title: 'slider 滑块 x 100',
sliderValue: 0
}
},
methods: {
sliderChanging(e : SliderChangeEvent) {
this.sliderValue = e.detail.value
console.log('value 发生变化:' + e.detail.value)
}
}
}
</script>
<style>
.flex-row {
flex-direction: row;
}
.flex-fill {
flex: 1;
}
</style>
pages/component/web-view-local/web-view-local.uvue
浏览文件 @
ff75f65c
...
@@ -3,17 +3,19 @@
...
@@ -3,17 +3,19 @@
<web-view ref="web-view" class="uni-flex-item" src="/hybrid/html/local.html" @onPostMessage="onPostMessage"
<web-view ref="web-view" class="uni-flex-item" src="/hybrid/html/local.html" @onPostMessage="onPostMessage"
@error="error" @loading="loading" @loaded="loaded">
@error="error" @loading="loading" @loaded="loaded">
</web-view>
</web-view>
<view class="uni-btn-v">
<view class="uni-padding-wrap uni-common-mt">
<button type="primary" @click="back">后退</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="back">后退</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="forward">前进</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="forward">前进</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="reload">重新加载</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="reload">重新加载</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="stop">停止加载</button>
<view class="uni-btn-v">
<button type="primary" @click="stop">停止加载</button>
</view>
</view>
</view>
</view>
</view>
</template>
</template>
...
...
pages/component/web-view/web-view.uvue
浏览文件 @
ff75f65c
...
@@ -3,17 +3,19 @@
...
@@ -3,17 +3,19 @@
<web-view ref="web-view" class="uni-flex-item" :src="src" :webview-styles="webview_styles"
<web-view ref="web-view" class="uni-flex-item" :src="src" :webview-styles="webview_styles"
@onPostMessage="onPostMessage" @error="error" @loading="loading" @loaded="loaded">
@onPostMessage="onPostMessage" @error="error" @loading="loading" @loaded="loaded">
</web-view>
</web-view>
<view class="uni-btn-v">
<view class="uni-padding-wrap uni-common-mt">
<button type="primary" @click="back">后退</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="back">后退</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="forward">前进</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="forward">前进</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="reload">重新加载</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="reload">重新加载</button>
<view class="uni-btn-v">
</view>
<button type="primary" @click="stop">停止加载</button>
<view class="uni-btn-v">
<button type="primary" @click="stop">停止加载</button>
</view>
</view>
</view>
</view>
</view>
</template>
</template>
...
...
pages/tabBar/component/component.uvue
浏览文件 @
ff75f65c
...
@@ -68,7 +68,11 @@
...
@@ -68,7 +68,11 @@
name: 'cover-view',
name: 'cover-view',
enable: false
enable: false
},
},
// #endif
// #endif
{
name:'list',
enable:false
}
] as Page[]
] as Page[]
}, {
}, {
id: 'content',
id: 'content',
...
@@ -124,6 +128,9 @@
...
@@ -124,6 +128,9 @@
name: 'slider',
name: 'slider',
enable: true
enable: true
}, {
}, {
name: 'slider-100',
enable: true
},{
name: 'switch',
name: 'switch',
enable: true
enable: true
}, {
}, {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录