Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
秃秃的瑾
uni-app
提交
db73cb94
U
uni-app
项目概览
秃秃的瑾
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
db73cb94
编写于
8月 13, 2018
作者:
X
xiaoyucoding
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
00ab14be
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
267 addition
and
94 deletion
+267
-94
.editorconfig
.editorconfig
+1
-1
examples/hello-uniapp/manifest.json
examples/hello-uniapp/manifest.json
+62
-60
examples/hello-uniapp/pages.json
examples/hello-uniapp/pages.json
+8
-1
examples/hello-uniapp/pages/API/share/share.vue
examples/hello-uniapp/pages/API/share/share.vue
+84
-27
examples/hello-uniapp/pages/component/form/form.vue
examples/hello-uniapp/pages/component/form/form.vue
+6
-2
examples/hello-uniapp/pages/component/view/view.vue
examples/hello-uniapp/pages/component/view/view.vue
+2
-2
examples/hello-uniapp/pages/template/product-list/product-list.vue
...hello-uniapp/pages/template/product-list/product-list.vue
+100
-0
examples/hello-uniapp/pages/template/template.vue
examples/hello-uniapp/pages/template/template.vue
+4
-1
未找到文件。
.editorconfig
浏览文件 @
db73cb94
...
...
@@ -6,7 +6,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size =
2
indent_size =
4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
...
...
examples/hello-uniapp/manifest.json
浏览文件 @
db73cb94
{
"name"
:
"hello uni-app"
,
"appid"
:
"__UNI__123213213"
,
"description"
:
"应用描述"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"app-plus"
:
{
/*
5
+App特有相关
*/
"modules"
:
{
"OAuth"
:
{},
"Payment"
:
{},
"Push"
:
{},
"Share"
:
{},
"Speech"
:
{}
},
"distribute"
:
{
/*
应用发布信息
*/
"android"
:
{
/*
android打包配置
*/
"permissions"
:
[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_COARSE_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_FINE_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_MOCK_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CALL_PHONE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_TASKS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.INTERNET
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MODIFY_AUDIO_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_CONTACTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECEIVE_BOOT_COMPLETED
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECORD_AUDIO
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.SEND_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.SYSTEM_ALERT_WINDOW
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_CONTACTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_EXTERNAL_STORAGE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECEIVE_USER_PRESENT
\"
/>"
]
},
"ios"
:
{},
/*
ios打包配置
*/
"sdkConfigs"
:
{},
/*
SDK配置
*/
"orientation"
:
[
"portrait-primary"
]
}
},
"quickapp"
:
{},
/*
快应用特有相关
*/
"mp-weixin"
:
{}
/*
小程序特有相关
*/
"name"
:
"hello uni-app"
,
"appid"
:
"__UNI__123213213"
,
"description"
:
"应用描述"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"app-plus"
:
{
/*
5
+App特有相关
*/
"modules"
:
{
"OAuth"
:
{},
"Payment"
:
{},
"Push"
:
{},
"Share"
:
{},
"Speech"
:
{},
"VideoPlayer"
:
{}
},
"distribute"
:
{
/*
应用发布信息
*/
"android"
:
{
/*
android打包配置
*/
"permissions"
:
[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_COARSE_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_FINE_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_MOCK_LOCATION
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CALL_PHONE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_TASKS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.INTERNET
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MODIFY_AUDIO_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_CONTACTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECEIVE_BOOT_COMPLETED
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECORD_AUDIO
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.SEND_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.SYSTEM_ALERT_WINDOW
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_CONTACTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_EXTERNAL_STORAGE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.RECEIVE_USER_PRESENT
\"
/>"
]
},
"ios"
:
{},
/*
ios打包配置
*/
"sdkConfigs"
:
{},
/*
SDK配置
*/
"orientation"
:
[
"portrait-primary"
]
}
},
"quickapp"
:
{},
/*
快应用特有相关
*/
"mp-weixin"
:
{}
/*
小程序特有相关
*/
}
examples/hello-uniapp/pages.json
浏览文件 @
db73cb94
...
...
@@ -301,7 +301,7 @@
"style"
:
{
"navigationBarTitleText"
:
"文件"
}
},{
},
{
"path"
:
"pages/API/get-location/get-location"
,
"style"
:
{
"navigationBarTitleText"
:
"获取位置"
...
...
@@ -432,6 +432,13 @@
"style"
:
{
"navigationBarTitleText"
:
"问题反馈"
}
},
{
"path"
:
"pages/template/product-list/product-list"
,
"style"
:
{
"navigationBarTitleText"
:
"商品列表"
,
"enablePullDownRefresh"
:
true
,
"onReachBottomDistance"
:
20
}
}
],
"globalStyle"
:
{
...
...
examples/hello-uniapp/pages/API/share/share.vue
浏览文件 @
db73cb94
...
...
@@ -8,14 +8,6 @@
<textarea
class=
"textarea"
v-model=
"shareText"
/>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view
class=
"page-section-title"
>
分享链接
</view>
<view
class=
"page-section"
>
<view
class=
"textarea-wrp"
>
<input
class=
"uni-input"
type=
"text"
v-model=
"href"
>
</view>
</view>
<!-- #endif -->
<view
class=
"page-section-title"
>
分享图片:
</view>
<view
class=
"page-section"
>
<view
class=
"uni-uploader-body"
>
...
...
@@ -24,9 +16,28 @@
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view
class=
"page-section-title"
>
分享类型:
</view>
<view
class=
"page-section"
>
<view
class=
"uni-uploader-body"
>
<radio-group
@
change=
"radioChange"
>
<label
class=
"radio"
>
<radio
value=
"1"
checked=
"true"
/>
文字
</label>
<label
class=
"radio"
>
<radio
value=
"2"
/>
图片
</label>
<label
class=
"radio"
>
<radio
value=
"0"
/>
图文
</label>
<label
class=
"radio"
>
<radio
value=
"5"
/>
小程序
</label>
</radio-group>
</view>
</view>
<view
class=
"btn-area"
v-if=
"providerList.length > 0"
>
<block
v-for=
"(value,index) in providerList"
:key=
"index"
>
<button
type=
"primary"
v-if=
"value"
@
tap=
"share(value)"
>
{{
value
.
name
}}
</button>
<button
type=
"primary"
v-if=
"value"
:disabled=
"shareType === 5 && value.name !== '分享到微信好友'"
@
tap=
"share(value)"
>
{{
value
.
name
}}
</button>
</block>
</view>
<!-- #endif -->
...
...
@@ -49,6 +60,7 @@
shareText
:
'
uni-app可以同时发布成原生App、微信小程序,邀请你一起体验!
'
,
href
:
"
https://uniapp.dcloud.io
"
,
image
:
''
,
shareType
:
1
,
providerList
:
[]
}
},
...
...
@@ -64,7 +76,6 @@
this
.
href
=
"
https://uniapp.dcloud.io
"
,
this
.
image
=
''
;
},
// #ifdef APP-PLUS
onLoad
:
function
()
{
uni
.
getProvider
({
service
:
"
share
"
,
...
...
@@ -117,17 +128,30 @@
}
});
},
// #endif
methods
:
{
async
share
(
e
)
{
console
.
log
(
"
分享通道:
"
,
e
.
id
);
console
.
log
(
"
分享通道:
"
+
e
.
id
+
"
; 分享类型:
"
+
this
.
shareType
);
if
(
!
this
.
shareText
&&
(
this
.
shareType
===
1
||
this
.
shareType
===
0
)){
uni
.
showModal
({
content
:
"
分享内容不能为空
"
,
showCancel
:
false
})
return
;
}
if
(
!
this
.
image
&&
(
this
.
shareType
===
2
||
this
.
shareType
===
0
)){
uni
.
showModal
({
content
:
"
分享图片不能为空
"
,
showCancel
:
false
})
return
;
}
let
shareOPtions
=
{
provider
:
e
.
id
,
scene
:
e
.
type
&&
e
.
type
===
'
WXSenceTimeline
'
?
'
WXSenceTimeline
'
:
"
WXSceneSession
"
,
//WXSceneSession”分享到聊天界面,“WXSenceTimeline”分享到朋友圈,“WXSceneFavorite”分享到微信收藏
type
:
this
.
image
&&
this
.
href
?
0
:
(
this
.
image
?
2
:
1
),
title
:
"
欢迎体验uniapp
"
,
summary
:
this
.
shareText
,
imageUrl
:
this
.
image
,
type
:
this
.
shareType
,
success
:
(
e
)
=>
{
console
.
log
(
"
success
"
,
e
);
uni
.
showModal
({
...
...
@@ -146,21 +170,47 @@
console
.
log
(
"
分享操作结束!
"
)
}
}
if
(
e
.
id
===
'
qq
'
&&
!
this
.
image
){
uni
.
showModal
({
content
:
"
分享到qq必须包含图片
"
,
showCancel
:
false
})
return
;
}
if
(
this
.
href
){
shareOPtions
.
href
=
this
.
href
;
switch
(
this
.
shareType
){
case
0
:
shareOPtions
.
summary
=
this
.
shareText
;
shareOPtions
.
imageUrl
=
this
.
image
;
shareOPtions
.
title
=
"
欢迎体验uniapp
"
;
shareOPtions
.
href
=
"
http://uniapp.dcloud.io
"
;
break
;
case
1
:
shareOPtions
.
summary
=
this
.
shareText
;
break
;
case
2
:
shareOPtions
.
imageUrl
=
this
.
image
;
break
;
case
5
:
shareOPtions
.
imageUrl
=
this
.
image
?
this
.
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uniapp/app/share-logo@3.png
'
shareOPtions
.
title
=
"
欢迎体验uniapp
"
;
shareOPtions
.
miniProgram
=
{
id
:
"
gh_33446d7f7a26
"
,
path
:
"
/pages/component/component
"
,
webUrl
:
"
http://uniapp.dcloud.io
"
,
type
:
0
};
break
;
default
:
break
;
}
if
(
shareOPtions
.
type
===
0
&&
plus
.
os
.
name
===
'
iOS
'
){
//如果是图文分享,且是ios平台,则压缩图片
if
(
shareOPtions
.
type
===
0
&&
plus
.
os
.
name
===
'
iOS
'
){
//如果是图文分享,且是ios平台,则压缩图片
shareOPtions
.
imageUrl
=
await
this
.
compress
();
}
if
(
shareOPtions
.
type
===
1
&&
shareOPtions
.
provider
===
'
qq
'
){
//如果是分享文字到qq,则必须加上href和title
shareOPtions
.
href
=
"
http://uniapp.dcloud.io
"
;
shareOPtions
.
title
=
"
欢迎体验uniapp
"
;
}
uni
.
share
(
shareOPtions
);
},
radioChange
(
e
){
console
.
log
(
"
type:
"
+
e
.
detail
.
value
);
this
.
shareType
=
parseInt
(
e
.
detail
.
value
);
},
chooseImage
()
{
uni
.
chooseImage
({
count
:
1
,
...
...
@@ -229,7 +279,7 @@
.textarea
{
border
:
2px
solid
#D8D8D8
;
padding
:
10px
;
height
:
10
0px
;
height
:
9
0px
;
width
:
690px
;
}
.uni-input
{
...
...
@@ -241,4 +291,11 @@
display
:
flex
;
justify-content
:
center
;
}
radio-group
{
box-sizing
:
border-box
;
width
:
100%
;
padding
:
0
30px
;
display
:
flex
;
justify-content
:
space-between
;
}
</
style
>
examples/hello-uniapp/pages/component/form/form.vue
浏览文件 @
db73cb94
...
...
@@ -36,8 +36,8 @@
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
input
</view>
<view
class=
"uni-list"
>
<view
class=
"uni-list-cell
uni-list-cell-pd
"
>
<input
name=
"input"
placeholder=
"这是一个输入框"
/>
<view
class=
"uni-list-cell"
>
<input
class=
"uni-input"
name=
"input"
placeholder=
"这是一个输入框"
/>
</view>
</view>
</view>
...
...
@@ -100,4 +100,8 @@
background-color
:
#007aff
;
color
:
#ffffff
;
}
.uni-input
{
width
:
100%
;
padding-left
:
30px
;
}
</
style
>
examples/hello-uniapp/pages/component/view/view.vue
浏览文件 @
db73cb94
...
...
@@ -50,11 +50,11 @@
<view
class=
"text"
>
横向布局-居右
</view>
<view
class=
"text"
>
横向布局-居右
</view>
</view>
<view
class=
"uni-flex
uni-row"
>
<view
class=
"uni-flex uni-row"
>
<view
class=
"text"
style=
"flex: 1;"
>
横向布局-平均分布
</view>
<view
class=
"text"
style=
"flex: 1;"
>
横向布局-平均分布
</view>
</view>
<view
class=
"uni-row"
style=
"justify-content: space-between;"
>
<view
class=
"uni-
flex uni-
row"
style=
"justify-content: space-between;"
>
<view
class=
"text"
>
横向布局-两端对齐
</view>
<view
class=
"text"
>
横向布局-两端对齐
</view>
</view>
...
...
examples/hello-uniapp/pages/template/product-list/product-list.vue
0 → 100644
浏览文件 @
db73cb94
<
template
>
<view
class=
"page"
>
<page-head
:title=
"title"
></page-head>
<view
class=
"product-list"
>
<view
v-for=
"(product,index) in productList"
:key=
"index"
>
<product
:image=
"product.image"
:title=
"product.title"
:originalPrice=
"product.originalPrice"
:favourPrice=
"product.favourPrice"
:tip=
"product.tip"
></product>
</view>
</view>
</view>
</
template
>
<
script
>
import
product
from
'
../../../components/product.vue
'
;
import
pageHead
from
'
../../../components/page-head.vue
'
;
export
default
{
data
()
{
return
{
title
:
'
product-list
'
,
productList
:
[]
}
},
components
:
{
product
,
pageHead
},
methods
:
{
loadData
(
action
=
'
add
'
)
{
const
data
=
[{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product1.jpg
'
,
title
:
'
Apple iPhone X 256GB 深空灰色 移动联通电信4G手机
'
,
originalPrice
:
9999
,
favourPrice
:
8888
,
tip
:
'
自营
'
},
{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product2.jpg
'
,
title
:
'
Apple iPad 平板电脑 2018年新款9.7英寸
'
,
originalPrice
:
3499
,
favourPrice
:
3399
,
tip
:
'
优惠
'
},
{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product3.jpg
'
,
title
:
'
Apple MacBook Pro 13.3英寸笔记本电脑(2017款Core i5处理器/8GB内存/256GB硬盘 MPXT2CH/A)
'
,
originalPrice
:
12999
,
favourPrice
:
10688
,
tip
:
'
秒杀
'
},
{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product4.jpg
'
,
title
:
'
Kindle Paperwhite电纸书阅读器 电子书墨水屏 6英寸wifi 黑色
'
,
originalPrice
:
999
,
favourPrice
:
958
,
tip
:
'
秒杀
'
},
{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product5.jpg
'
,
title
:
'
微软(Microsoft)新Surface Pro 二合一平板电脑笔记本 12.3英寸(i5 8G内存 256G存储)
'
,
originalPrice
:
8888
,
favourPrice
:
8288
,
tip
:
'
优惠
'
},
{
image
:
'
https://img-cdn-qiniu.dcloud.net.cn/uploads/example/product6.jpg
'
,
title
:
'
Apple Watch Series 3智能手表(GPS款 42毫米 深空灰色铝金属表壳 黑色运动型表带 MQL12CH/A)
'
,
originalPrice
:
2899
,
favourPrice
:
2799
,
tip
:
'
自营
'
}];
if
(
action
===
'
refresh
'
)
{
this
.
productList
=
[];
}
data
.
forEach
(
item
=>
{
this
.
productList
.
push
(
item
);
});
}
},
onLoad
()
{
this
.
loadData
();
},
onPullDownRefresh
()
{
this
.
loadData
(
'
refresh
'
);
// 实际开发中通常是网络请求,加载完数据后就停止。这里仅做演示,加延迟为了体现出效果。
setTimeout
(()
=>
{
uni
.
stopPullDownRefresh
();
},
2000
);
},
onReachBottom
()
{
this
.
loadData
();
}
}
</
script
>
<
style
>
.product-list
{
display
:
flex
;
width
:
100%
;
flex-wrap
:
wrap
;
flex-direction
:
row
;
}
</
style
>
examples/hello-uniapp/pages/template/template.vue
浏览文件 @
db73cb94
...
...
@@ -52,7 +52,10 @@
},
{
name
:
'
图文列表
'
,
url
:
'
media-list
'
},
{
},
{
name
:
'
商品列表
'
,
url
:
'
product-list
'
},{
name
:
'
九宫格
'
,
url
:
'
grid
'
},
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录