提交 0754ee66 编写于 作者: Q qiang

Merge branch 'alpha'

# Conflicts:
#	docs/uniCloud/faq.md
#	docs/uniCloud/univerify.md
......@@ -45,9 +45,9 @@
**Tips**
- 如果type属性extension同时存在,例如`{type:'image',extension:['.png','.jpg']}`,则会选择`image/png,image/jpg`文件
- 如果只配置extension属性,例如`{extension:['.doc','.xlsx','.docx']}`,则会选择`.doc,.xlsx,.docx`文件
- 详情见[`accept`](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/accept)属性
- 如果type属性extension同时存在,例如`{type:'image',extension:['.png','.jpg']}`,则会选择`image/png,image/jpg`文件
- 如果只配置extension属性,例如`{extension:['.doc','.xlsx','.docx']}`,则会选择`.doc,.xlsx,.docx`文件,详情见[`accept属性`](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/accept)
- 在微信环境中,如果`type="all"`,则`extension`属性失效
**success 返回参数说明**
......
......@@ -256,13 +256,15 @@ uni.chooseImage({
**OBJECT 参数说明**
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :- | :- | :- | :- | :- |
| src | String | | 是 | 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 |
| quality | Number | 80 | 否 | 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) |
| success | Function | | 否 | 接口调用成功的回调函数 |
| fail | Function | | 否 | 接口调用失败的回调函数 |
| complete | Function | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
| 属性 | 类型 | 默认值 | 必填 | 说明 | 平台差异说明 |
| :- | :- | :- | :- | :- | :- |
| src | String | | 是 | 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 ||
| quality | Number | 80 | 否 | 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) ||
| width | String | auto | 否 | 缩放图片的宽度,支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即根据height与源图高的缩放比例计算,若未设置height则使用源图高度)|App 3.0.0+|
| height | String | auto | 否 | 缩放图片的高度,支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即根据height与源图高的缩放比例计算,若未设置height则使用源图高度)|App 3.0.0+|
| success | Function | | 否 | 接口调用成功的回调函数 ||
| fail | Function | | 否 | 接口调用失败的回调函数 ||
| complete | Function | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) ||
**success 返回参数说明**
......
......@@ -19,6 +19,7 @@ H5平台登陆注意事项:
|provider|String|否|登录服务提供商,通过 [uni.getProvider](/api/plugins/provider) 获取,如果不设置则弹出登录列表选择界面||
|scopes|String/Array|见平台差异说明|授权类型,默认 auth_base。支持 auth_base(静默授权)/ auth_user(主动授权) / auth_zhima(芝麻信用)|支付宝小程序|
|timeout|Number|否|超时时间,单位ms|微信小程序、百度小程序|
|univerifyStyle|Object|否|[一键登录](/univerify)页面样式|App 3.0.0+|
|success|Function|否|接口调用成功的回调||
|fail|Function|否|接口调用失败的回调函数||
|complete|Function|否|接口调用结束的回调函数(调用成功、失败都会执行)| |
......@@ -38,6 +39,7 @@ H5平台登陆注意事项:
* [百度小程序登录](https://smartprogram.baidu.com/docs/develop/api/open_log/#%E6%8E%88%E6%9D%83%E6%B5%81%E7%A8%8B%E8%AF%B4%E6%98%8E/)
* [字节跳动小程序登录](https://developer.toutiao.com/dev/cn/mini-app/develop/open-capacity/log-in/login)
* [Apple登录、苹果登录、Sign in with Apple](https://ask.dcloud.net.cn/article/36651)
* [一键登陆](/univerify)
如果服务端使用`uniCloud`,那么官方提供了[uni-id](https://uniapp.dcloud.net.cn/uniCloud/uni-id)云端统一登录服务,把微信登录、短信验证码登录及角色权限管理等服务端登录开发,进行了统一的封装。
......@@ -163,3 +165,31 @@ uni.login({
#### App端集成其他登陆SDK如支付宝、淘宝、facebook登陆的说明
1. [支付宝登陆](https://ext.dcloud.net.cn/search?q=%E6%94%AF%E4%BB%98%E5%AE%9D%E7%99%BB%E9%99%86)[淘宝登陆](https://ext.dcloud.net.cn/search?q=%E7%99%BE%E5%B7%9D)[抖音登录](https://ext.dcloud.net.cn/search?q=%E6%8A%96%E9%9F%B3%E7%99%BB%E5%BD%95)[facebook登录](https://ext.dcloud.net.cn/search?q=facebook%E7%99%BB%E5%BD%95)等在插件市场均已有插件,还有[sharesdk](https://ext.dcloud.net.cn/search?q=sharesdk)等专业集成多家登录分享的插件。
2. 也可以内嵌web-view组件,使用web登陆模式集成这些三方登陆
### uni.preLogin(OBJECT)
预登录。
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|3.0.0+|x|x|x|x|x|x|
**OBJECT 参数说明**
|参数名|类型|必填|说明|
|:-|:-|:-|:-|
|provider|String|否|登录服务提供商,通过 [uni.getProvider](/api/plugins/provider) 获取,目前仅支持[一键登陆](/univerify)|
|success|Function|否|接口调用成功的回调|
|fail|Function|否|接口调用失败的回调函数|
|complete|Function|否|接口调用结束的回调函数(调用成功、失败都会执行)|
### uni.closeAuthView()
关闭[一键登陆](/univerify)页面。
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|3.0.0+|x|x|x|x|x|x|
......@@ -46,7 +46,8 @@
||qq|QQ登录||
||sinaweibo|新浪微博登录||
||xiaomi|小米登录||
||apple|[Apple登录](https://ask.dcloud.net.cn/article/36651)|仅iOS13支持,HBuilderX 2.4.7+|
||univerify|[一键登录](/univerify)|App 3.0.0+|
||apple|[Apple登录](https://ask.dcloud.net.cn/article/36651)|仅iOS13支持,App 2.4.7+|
|share|sinaweibo|新浪微博分享||
||qq|分享到QQ好友||
||weixin|分享微信消息、朋友圈及微信小程序||
......
......@@ -6,7 +6,7 @@
|参数名 |类型 |必填 |说明 |
|:- |:- |:- |:- |
|scrollTop|String | |滚动到页面的目标位置(单位px) |
|scrollTop|String | |滚动到页面的目标位置(单位px) |
|selector |String |否 |选择器,微信小程序2.7.3+ 、支付宝小程序1.20.0+支持 |
|duration |Number |否 |滚动动画的时长,默认300ms,单位 ms |
|success |function |否 |接口调用成功的回调函数 |
......
......@@ -915,15 +915,15 @@ h5 平台下拉刷新动画,只有 circle 类型。
|color|HexColor|是||tab 上的文字默认颜色||
|selectedColor|HexColor|是||tab 上的文字选中时的颜色||
|backgroundColor|HexColor|是||tab 的背景色||
|borderStyle|String|否|black|tabbar 上边框的颜色,可选值 black/white|App 2.3.4+ 支持其他颜色值|
|blurEffect|String|否|none|iOS 高斯模糊效果,可选值 dark/extralight/light/none(参考:[使用说明](https://ask.dcloud.net.cn/article/36617))|App 2.4.0+ 支持|
|borderStyle|String|否|black|tabbar 上边框的颜色,可选值 black/white|App 2.3.4+ 支持其他颜色值、H5 3.0.0+|
|blurEffect|String|否|none|iOS 高斯模糊效果,可选值 dark/extralight/light/none(参考:[使用说明](https://ask.dcloud.net.cn/article/36617))|App 2.4.0+ 支持、H5 3.0.0+(只有最新版浏览器才支持)|
|list|Array|是||tab 的列表,详见 list 属性说明,最少2个、最多5个 tab||
|position|String|否|bottom|可选值 bottom、top|top 值仅微信小程序支持|
|fontSize|String|否|10px|文字默认大小|App 2.3.4+|
|iconWidth|String|否|24px|图标默认宽度(高度等比例缩放)|App 2.3.4+|
|spacing|String|否|3px|图标和文字的间距|App 2.3.4+|
|height|String|否|50px|tabBar 默认高度|App 2.3.4+|
|midButton|Object|否||中间按钮 仅在 list 项为偶数时有效|App 2.3.4+|
|fontSize|String|否|10px|文字默认大小|App 2.3.4+、H5 3.0.0+|
|iconWidth|String|否|24px|图标默认宽度(高度等比例缩放)|App 2.3.4+、H5 3.0.0+|
|spacing|String|否|3px|图标和文字的间距|App 2.3.4+、H5 3.0.0+|
|height|String|否|50px|tabBar 默认高度|App 2.3.4+、H5 3.0.0+|
|midButton|Object|否||中间按钮 仅在 list 项为偶数时有效|App 2.3.4+、H5 3.0.0+|
其中 list 接收一个数组,数组中的每个项都是一个对象,其属性值如下:
......
......@@ -23,6 +23,7 @@
|selection-end|Number|-1|光标结束位置,自动聚集时有效,需与selection-start搭配使用||
|adjust-position|Boolean|true|键盘弹起时,是否自动上推页面|App-Android(vue 页面 softinputMode 为 adjustResize 时无效)、微信小程序、百度小程序、QQ小程序|
|hold-keyboard|boolean|false|focus时,点击页面的时候不收起键盘|微信小程序2.8.2|
|auto-blur|boolean|false|键盘收起时,是否自动失去焦点|App 3.0.0+|
|@input|EventHandle||当键盘输入时,触发input事件,event.detail = {value}|差异见下方 Tips|
|@focus|EventHandle||输入框聚焦时触发,event.detail = { value, height },height 为键盘高度|仅微信小程序、App(2.2.3+) 、QQ小程序支持 height|
|@blur|EventHandle||输入框失去焦点时触发,event.detail = {value: value}||
......
......@@ -24,6 +24,7 @@
|adjust-position|Boolean|true|键盘弹起时,是否自动上推页面|App-Android(softinputMode 为 adjustResize 时无效)、微信小程序、百度小程序、QQ小程序|
|disable-default-padding|boolean|false|是否去掉 iOS 下的默认内边距|微信小程序2.10.0|
|hold-keyboard|boolean|false|focus时,点击页面的时候不收起键盘|微信小程序2.8.2|
|auto-blur|boolean|false|键盘收起时,是否自动失去焦点|App 3.0.0+|
|@focus|EventHandle||输入框聚焦时触发,event.detail = { value, height },height 为键盘高度|仅微信小程序、App(HBuilderX 2.0+ [nvue uni-app模式](http://ask.dcloud.net.cn/article/36074)) 、QQ小程序支持 height|
|@blur|EventHandle||输入框失去焦点时触发,event.detail = {value, cursor}||
|@linechange|EventHandle||输入框行数变化时调用,event.detail = {height: 0, heightRpx: 0, lineCount: 0}|字节跳动小程序不支持,nvue ios暂不支持|
......
......@@ -6,7 +6,7 @@ univerify是替代短信验证登录的下一代登录验证方式,能消除
## 客户端@client
客户端如何使用一键登录请参考此文档:[univerify 使用指南](https://uniapp.dcloud.io/univerify)
客户端如何使用一键登录请参考此文档:[univerify 使用指南](/univerify)
## 云函数@cloud
......
......@@ -12,5 +12,5 @@
"message": "chore(release): publish %s"
}
},
"version": "2.0.0-alpha-29920201113004"
"version": "2.0.0-alpha-30020201218003"
}
......@@ -171,7 +171,10 @@ const ui = [
'showRightWindow',
'hideTopWindow',
'hideLeftWindow',
'hideRightWindow'
'hideRightWindow',
'setTopWindowStyle',
'setLeftWindowStyle',
'setRightWindowStyle'
]
const event = [
......@@ -204,6 +207,8 @@ const third = [
'login',
'checkSession',
'getUserInfo',
'preLogin',
'closeAuthView',
'share',
'shareWithSystem',
'showShareMenu',
......
......@@ -36,6 +36,7 @@
"dependencies": {
"base64-arraybuffer": "^0.2.0",
"intersection-observer": "^0.7.0",
"pako": "^1.0.11",
"safe-area-insets": "^1.4.1"
},
"private": true,
......
{
"name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app app-plus-nvue",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
此差异已折叠。
{
"name": "@dcloudio/uni-app-plus",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app app-plus",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "app-plus",
"title": "APP-PLUS"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-automator",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app automator",
"main": "dist/index.js",
"repository": {
......@@ -30,5 +30,5 @@
"node-simctl": "^6.1.0",
"puppeteer": "^3.0.1"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
<template>
<view>
<slot
:options="options"
:data="dataList"
:pagination="paginationInternal"
:loading="loading"
:error="errorMessage"
/>
</view>
</template>
<script>
const events = {
load: 'load',
error: 'error'
}
const pageMode = {
add: 'add',
replace: 'replace'
}
const attrs = [
'pageCurrent',
'pageSize',
'collection',
'action',
'field',
'getcount',
'orderby',
'where'
]
export default {
name: 'UniClouddb',
props: {
options: {
type: [Object, Array],
default () {
return {}
}
},
collection: {
type: String,
default: ''
},
action: {
type: String,
default: ''
},
field: {
type: String,
default: ''
},
pageData: {
type: String,
default: 'add'
},
pageCurrent: {
type: Number,
default: 1
},
pageSize: {
type: Number,
default: 20
},
getcount: {
type: [Boolean, String],
default: false
},
orderby: {
type: String,
default: ''
},
where: {
type: [String, Object],
default: ''
},
getone: {
type: [Boolean, String],
default: false
},
manual: {
type: Boolean,
default: false
}
},
data () {
return {
loading: false,
dataList: this.getone ? {} : [],
paginationInternal: {
current: this.pageCurrent,
size: this.pageSize,
count: 0
},
errorMessage: ''
}
},
created () {
this._isEnded = false
this.$watch(() => {
var al = []
attrs.forEach(key => {
al.push(this[key])
})
return al
}, (newValue, oldValue) => {
this.paginationInternal.pageSize = this.pageSize
let needReset = false
for (let i = 2; i < newValue.length; i++) {
if (newValue[i] !== oldValue[i]) {
needReset = true
break
}
}
if (needReset) {
this.clear()
this.reset()
}
if (newValue[0] !== oldValue[0]) {
this.paginationInternal.current = this.pageCurrent
}
this._execLoadData()
})
// #ifdef H5
if (process.env.NODE_ENV === 'development') {
this._debugDataList = []
if (!window.unidev) {
window.unidev = {
clientDB: {
data: []
}
}
}
window.unidev.clientDB.data.push(this._debugDataList)
}
// #endif
// #ifdef MP-TOUTIAO
let changeName
const events = this.$scope.dataset.eventOpts
for (var i = 0; i < events.length; i++) {
const event = events[i]
if (event[0].includes('^load')) {
changeName = event[1][0][0]
}
}
if (changeName) {
let parent = this.$parent
let maxDepth = 16
this._changeDataFunction = null
while (parent && maxDepth > 0) {
const fun = parent[changeName]
if (fun && typeof fun === 'function') {
this._changeDataFunction = fun
maxDepth = 0
break
}
parent = parent.$parent
maxDepth--
}
}
// #endif
if (!this.manual) {
this.loadData()
}
},
// #ifdef H5
beforeDestroy () {
if (process.env.NODE_ENV === 'development' && window.unidev) {
var cd = this._debugDataList
var dl = window.unidev.clientDB.data
for (var i = dl.length - 1; i >= 0; i--) {
if (dl[i] === cd) {
dl.splice(i, 1)
break
}
}
}
},
// #endif
methods: {
loadData (args1, args2) {
let callback = null
if (typeof args1 === 'object') {
if (args1.clear) {
this.clear()
this.reset()
}
if (args1.current !== undefined) {
this.paginationInternal.current = args1.current
}
if (typeof args2 === 'function') {
callback = args2
}
} else if (typeof args1 === 'function') {
callback = args1
}
this._execLoadData(callback)
},
loadMore () {
if (this._isEnded) {
return
}
this._execLoadData()
},
refresh () {
this.clear()
this._execLoadData()
},
clear () {
this._isEnded = false
this.dataList = []
},
reset () {
this.paginationInternal.current = 1
},
add (value, {
toastTitle,
success,
fail,
complete
} = {}) {
uni.showLoading()
/* eslint-disable no-undef */
const db = uniCloud.database()
db.collection(this.collection).add(value).then((res) => {
success && success(res)
uni.showToast({
title: toastTitle || '新增成功'
})
}).catch((err) => {
fail && fail(err)
uni.showModal({
content: err.message,
showCancel: false
})
}).finally(() => {
uni.hideLoading()
complete && complete()
})
},
remove (id, {
action,
success,
fail,
complete,
confirmTitle,
confirmContent
} = {}) {
if (!id || !id.length) {
return
}
uni.showModal({
title: confirmTitle || '提示',
content: confirmContent || '是否删除该数据',
showCancel: true,
success: (res) => {
if (!res.confirm) {
return
}
this._execRemove(id, action, success, fail, complete)
}
})
},
update (id, value, {
toastTitle,
success,
fail,
complete
} = {}) {
uni.showLoading()
/* eslint-disable no-undef */
const db = uniCloud.database()
return db.collection(this.collection).doc(id).update(value).then((res) => {
success && success(res)
uni.showToast({
title: toastTitle || '修改成功'
})
}).catch((err) => {
fail && fail(err)
uni.showModal({
content: err.message,
showCancel: false
})
}).finally(() => {
uni.hideLoading()
complete && complete()
})
},
_execLoadData (callback) {
if (this.loading) {
return
}
this.loading = true
this.errorMessage = ''
this._getExec().then((res) => {
this.loading = false
const {
data,
count
} = res.result
this._isEnded = data.length < this.pageSize
const data2 = this.getone ? (data.length ? data[0] : undefined) : data
callback && callback(data2, this._isEnded)
this._dispatchEvent(events.load, data2)
if (this.pageData === pageMode.add) {
this.dataList.push(...data2)
if (this.dataList.length) {
this.paginationInternal.current++
}
} else {
this.dataList = data2
}
if (this.getcount) {
this.paginationInternal.count = count
}
// #ifdef H5
if (process.env.NODE_ENV === 'development') {
this._debugDataList.length = 0
this._debugDataList.push(...JSON.parse(JSON.stringify(this.dataList)))
}
// #endif
}).catch((err) => {
this.loading = false
this.errorMessage = err
callback && callback()
this.$emit(events.error, err)
if (process.env.NODE_ENV === 'development') {
console.error(err)
}
})
},
_getExec () {
/* eslint-disable no-undef */
let db = uniCloud.database()
if (this.action) {
db = db.action(this.action)
}
db = db.collection(this.collection)
if (!(!this.where || !Object.keys(this.where).length)) {
db = db.where(this.where)
}
if (this.field) {
db = db.field(this.field)
}
if (this.orderby) {
db = db.orderBy(this.orderby)
}
const {
current,
size
} = this.paginationInternal
db = db.skip(size * (current - 1)).limit(size).get({
getCount: this.getcount
})
return db
},
_execRemove (id, action, success, fail, complete) {
if (!this.collection || !id) {
return
}
const ids = Array.isArray(id) ? id : [id]
if (!ids.length) {
return
}
uni.showLoading({
mask: true
})
/* eslint-disable no-undef */
const db = uniCloud.database()
const dbCmd = db.command
let exec = db
if (action) {
exec = exec.action(action)
}
exec.collection(this.collection).where({
_id: dbCmd.in(ids)
}).remove().then((res) => {
success && success(res.result)
if (this.pageData === pageMode.replace) {
this.refresh()
} else {
this.removeData(ids)
}
}).catch((err) => {
fail && fail(err)
uni.showModal({
content: err.message,
showCancel: false
})
}).finally(() => {
uni.hideLoading()
complete && complete()
})
},
removeData (ids) {
const il = ids.slice(0)
const dl = this.dataList
for (let i = dl.length - 1; i >= 0; i--) {
const index = il.indexOf(dl[i]._id)
if (index >= 0) {
dl.splice(i, 1)
il.splice(index, 1)
}
}
},
_dispatchEvent (type, data) {
if (this._changeDataFunction) {
this._changeDataFunction(data, this._isEnded)
} else {
this.$emit(type, data, this._isEnded)
}
}
}
}
</script>
......@@ -8,7 +8,7 @@ const {
capitalize
} = require('./util')
const {
const {
getJson,
parseJson
} = require('./json')
......@@ -32,10 +32,10 @@ function getNVueMainEntry () {
}
return nvueMainEntry
}
function getPagesJson () {
return processPagesJson(getJson('pages.json', true))
}
function getPagesJson () {
return processPagesJson(getJson('pages.json', true))
}
function parsePagesJson (content, loader) {
return processPagesJson(parseJson(content, true), loader)
......@@ -339,31 +339,72 @@ const isDirectory = source => fs.lstatSync(source).isDirectory()
function getAutoComponentsByDir (componentsPath, absolute = false) {
const components = {}
try {
fs.existsSync(componentsPath) && fs.readdirSync(componentsPath).forEach(name => {
const folder = path.resolve(componentsPath, name)
if (!isDirectory(folder)) {
return
}
const importDir = absolute ? normalizePath(folder) : `@/components/${name}`
// 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
const files = fs.readdirSync(folder)
if (files.includes(name + '.vue')) {
components[`^${name}$`] = `${importDir}/${name}.vue`
} else if (files.includes(name + '.nvue')) {
components[`^${name}$`] = `${importDir}/${name}.nvue`
if (fs.existsSync(componentsPath)) {
let importComponentsDir = '@/components'
const uniModulesDir = path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules')
if (!absolute && componentsPath.includes(uniModulesDir)) {
importComponentsDir = `@/uni_modules/${path.basename(path.dirname(componentsPath))}/components`
}
})
fs.readdirSync(componentsPath).forEach(name => {
const folder = path.resolve(componentsPath, name)
if (!isDirectory(folder)) {
return
}
const importDir = absolute ? normalizePath(folder) : `${importComponentsDir}/${name}`
// 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
const files = fs.readdirSync(folder)
if (files.includes(name + '.vue')) {
components[`^${name}$`] = `${importDir}/${name}.vue`
} else if (files.includes(name + '.nvue')) {
components[`^${name}$`] = `${importDir}/${name}.nvue`
}
})
}
} catch (e) {
console.log(e)
}
return components
}
function initAutoImportScanComponents () {
const componentsPath = path.resolve(process.env.UNI_INPUT_DIR, 'components')
const components = getAutoComponentsByDir(componentsPath)
function initAutoComponents () {
const allComponents = {}
const componentsDirs = [path.resolve(process.env.UNI_INPUT_DIR, 'components')]
global.uniModules.forEach(module => {
componentsDirs.push(path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'components'))
})
componentsDirs.forEach((componentsDir) => {
// 根目录 components 使用相对路径,uni_modules 使用绝对路径
const currentComponents = getAutoComponentsByDir(componentsDir, false)
Object.keys(currentComponents).forEach(name => {
(allComponents[name] || (allComponents[name] = [])).push(currentComponents[name])
})
})
const components = {}
const conflictFiles = []
Object.keys(allComponents).forEach(name => {
const files = allComponents[name]
components[name] = files[0]
if (files.length > 1) {
conflictFiles.push(files)
}
})
if (conflictFiles.length > 0) {
conflictFiles.forEach(files => {
let usedFile
console.warn('easycom组件冲突:[' + files.map((file, index) => {
if (index === 0) {
usedFile = file
}
return file
}).join(',') + '],优先使用:' + usedFile)
console.log('\n')
})
}
return components
}
function initAutoImportScanComponents () {
const components = initAutoComponents()
if (process.env.UNI_PLATFORM === 'quickapp-native') {
if (!uniQuickAppAutoImportScanComponents) {
uniQuickAppAutoImportScanComponents = getAutoComponentsByDir(
......@@ -463,7 +504,7 @@ function parseUsingAutoImportComponents (usingAutoImportComponents) {
return autoImportComponents
}
const BUILT_IN_COMPONENTS = ['page-meta', 'navigation-bar', 'uni-match-media']
const BUILT_IN_COMPONENTS = ['page-meta', 'navigation-bar', 'uni-match-media', 'unicloud-db']
function isBuiltInComponent (name) {
return BUILT_IN_COMPONENTS.includes(name)
......
{
"name": "@dcloudio/uni-cli-shared",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-cli-shared",
"main": "lib/index.js",
"repository": {
......@@ -23,5 +23,5 @@
"postcss-urlrewrite": "^0.2.2",
"strip-json-comments": "^2.0.1"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-h5-ui",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app h5 ui",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
此差异已折叠。
......@@ -783,6 +783,18 @@
"/platforms/h5/service/api/ui/windows.js",
[]
],
"setTopWindowStyle": [
"/platforms/h5/service/api/ui/windows.js",
[]
],
"setLeftWindowStyle": [
"/platforms/h5/service/api/ui/windows.js",
[]
],
"setRightWindowStyle": [
"/platforms/h5/service/api/ui/windows.js",
[]
],
"$emit": [
"/platforms/h5/service/api/base/event-bus.js",
[
......
{
"name": "@dcloudio/uni-h5",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app h5",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -16,6 +16,7 @@
"dependencies": {
"base64-arraybuffer": "^0.2.0",
"intersection-observer": "^0.7.0",
"pako": "^1.0.11",
"safe-area-insets": "^1.4.1"
},
"uni-app": {
......@@ -23,5 +24,5 @@
"title": "H5",
"main": "lib/h5/uni.config.js"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-migration",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app migration",
"main": "lib/index.js",
"repository": {
......@@ -20,7 +20,7 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380",
"gitHead": "c135dec26ebb9c45211964ed038893f252612853",
"dependencies": {
"commander": "^4.0.1",
"fs-extra": "^8.1.0",
......
......@@ -2162,7 +2162,7 @@ function handleRef (ref) {
}
function triggerEvent (type, detail, options) {
const handler = this.props[customize('on-' + type)];
const handler = this.props && this.props[customize('on-' + type)];
if (!handler) {
return
}
......@@ -2405,7 +2405,8 @@ function parsePage (vuePageOptions) {
},
__r: handleRef,
__e: handleEvent,
__l: handleLink$1
__l: handleLink$1,
triggerEvent
};
initHooks(pageOptions, hooks$1, vuePageOptions);
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-alipay",
"title": "支付宝小程序"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-baidu",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-baidu",
"title": "百度小程序"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-kuaishou",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-kuaishou",
"main": "dist/index.js",
"repository": {
......@@ -16,5 +16,6 @@
"uni-app": {
"name": "mp-kuaishou",
"title": "快手小程序"
}
},
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-qq",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-qq",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-qq",
"title": "QQ小程序"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-toutiao",
"title": "字节跳动小程序"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-vue",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "@dcloudio/uni-mp-vue",
"main": "dist/vue.runtime.esm.js",
"module": "dist/vue.runtime.esm.js",
......@@ -23,5 +23,5 @@
"bugs": {
"url": "https://github.com/dcloudio/uni-app/issues"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-mp-weixin",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-weixin",
"title": "微信小程序"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-quickapp-native",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app quickapp-native",
"main": "dist/vue.prod.js",
"repository": {
......@@ -19,7 +19,7 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380",
"gitHead": "c135dec26ebb9c45211964ed038893f252612853",
"uni-app": {
"name": "quickapp-native",
"title": "快应用(Native)版"
......
{
"name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app quickapp-webview",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "quickapp-webview",
"title": "快应用(Webview)版"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
{
"name": "@dcloudio/uni-stat",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "",
"main": "dist/index.js",
"repository": {
......@@ -34,5 +34,5 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
......@@ -699,6 +699,11 @@ describe('mp:compiler-extra', () => {
'<view v-for="item in list" @click="test(item)">{{ item }}</view>',
'<block wx:for="{{list}}" wx:for-item="item" wx:for-index="__i0__"><view data-event-opts="{{[[\'tap\',[[\'test\',[\'$0\'],[[[\'list\',\'\',__i0__]]]]]]]}}" bindtap="__e">{{item}}</view></block>'
)
assertCodegen(
'<view v-for="(item, index) in [{x:[1,2,3,4]}]"><view v-for="item2 in item.x" @click="test(item2)">{{ item2 }}+{{index}}</view></view>',
'<block wx:for="{{[{x:[1,2,3,4]}]}}" wx:for-item="item" wx:for-index="index"><view><block wx:for="{{item.x}}" wx:for-item="item2" wx:for-index="__i0__"><view data-event-opts="{{[[\'tap\',[[\'e0\',[\'$event\']]]]]}}" data-event-params="{{({item2})}}" bindtap="__e">{{item2+"+"+index}}</view></block></view></block>',
'with(this){if(!_isMounted){e0=function($event,item2){var _temp=arguments[arguments.length-1].currentTarget.dataset,_temp2=_temp.eventParams||_temp["event-params"],item2=_temp2.item2;var _temp,_temp2;return test(item2)}}}'
)
})
it('generate bool attr', () => {
assertCodegen(
......
......@@ -35,6 +35,17 @@ describe('mp:compiler-mp-weixin', () => {
expect(res.generic[0]).toBe('test-foo-default')
}
)
assertCodegen(
'<uni-clientdb v-slot:default="{data}"><uni-table><uni-tr><uni-th align="center">日期</uni-th></uni-tr></uni-table></uni-clientdb>',
'<uni-clientdb generic:scoped-slots-default="test-uni-clientdb-default" data-vue-generic="scoped" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[\'default\']}}"></uni-clientdb>',
function (res) {
expect(res.generic[0]).toBe('test-uni-clientdb-default')
const wxmlKey = Object.keys(res.files)[0]
expect(res.files[wxmlKey]).toBe(
'<uni-table vue-id="551070e6-2" bind:__l="__l" vue-slots="{{[\'default\']}}"><uni-tr vue-id="{{(\'551070e6-3\')+\',\'+(\'551070e6-2\')}}" bind:__l="__l" vue-slots="{{[\'default\']}}"><uni-th vue-id="{{(\'551070e6-4\')+\',\'+(\'551070e6-3\')}}" align="center" bind:__l="__l" vue-slots="{{[\'default\']}}">日期</uni-th></uni-tr></uni-table>'
)
}
)
})
it('generate named scoped slot', () => {
......@@ -130,8 +141,11 @@ describe('mp:compiler-mp-weixin', () => {
'<template v-for="(item, key) in { list1, list2 }"></template>',
'<block wx:for="{{({list1,list2})}}" wx:for-item="item" wx:for-index="key"></block>'
)
assertCodegen('<test :obj="{x:0}"></test>', '<test vue-id="551070e6-1" obj="{{({x:0})}}" bind:__l="__l"></test>')
assertCodegen('<test :obj="{\'x\':0}"></test>', '<test vue-id="551070e6-1" obj="{{$root.a0}}" bind:__l="__l"></test>', 'with(this){var a0={"x":0};$mp.data=Object.assign({},{$root:{a0:a0}})}')
assertCodegen('<test :obj="{x:0}"></test>',
'<test vue-id="551070e6-1" obj="{{({x:0})}}" bind:__l="__l"></test>')
assertCodegen('<test :obj="{\'x\':0}"></test>',
'<test vue-id="551070e6-1" obj="{{$root.a0}}" bind:__l="__l"></test>',
'with(this){var a0={"x":0};$mp.data=Object.assign({},{$root:{a0:a0}})}')
assertCodegen(
'<test :obj="{x:{x:0}}"></test>', '<test vue-id="551070e6-1" obj="{{$root.a0}}" bind:__l="__l"></test>',
'with(this){var a0={x:{x:0}};$mp.data=Object.assign({},{$root:{a0:a0}})}'
......@@ -144,4 +158,4 @@ describe('mp:compiler-mp-weixin', () => {
'<test data-custom-hidden="{{!(shown)}}" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[\'default\']}}">hello world</test>'
)
})
})
})
......@@ -22,7 +22,7 @@ const res = compiler.compile(
<custom data-a="1" :data-b="b"></custom>
`, {
miniprogram: true,
resourcePath: '/User/fxy/Documents/test.wxml',
resourcePath: 'test.wxml',
isReservedTag: function (tag) {
return true
},
......
{
"name": "@dcloudio/uni-template-compiler",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-template-compiler",
"main": "lib/index.js",
"repository": {
......@@ -22,5 +22,5 @@
"@babel/types": "^7.3.3",
"vue-template-compiler": "^2.6.10"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
......@@ -95,7 +95,7 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
const defines = {
'process.env.UNI_ENV': JSON.stringify(process.env.UNI_PLATFORM),
'process.env.UNI_CLOUD_PROVIDER': process.env.UNI_CLOUD_PROVIDER,
'process.env.HBX_USER_TOKEN': JSON.stringify(process.env.HBX_USER_TOKEN || ''),
'process.env.UNICLOUD_DEBUG': process.env.UNICLOUD_DEBUG,
'process.env.UNI_AUTOMATOR_WS_ENDPOINT': JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT)
}
if (process.env.UNI_USING_VUE3) {
......
......@@ -36,6 +36,7 @@ module.exports = function (content, map) {
this.callback(null,
`<style>
view,
label,
swiper-item,
scroll-view {
display:flex;
......@@ -62,6 +63,9 @@ module.exports = function (content, map) {
swiper-item {
position: absolute;
}
button {
margin: 0;
}
</style>
${content}`,
map)
......
{
"name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "webpack-uni-mp-loader",
"main": "index.js",
"repository": {
......@@ -16,5 +16,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
......@@ -57,7 +57,7 @@ const getPageComponents = function (inputDir, pagesJson) {
if (tabBarList.length) { // 添加全部属性,方便 Vue 响应式
pagesJson.tabBar.color = pagesJson.tabBar.color || '#999'
pagesJson.tabBar.selectedColor = pagesJson.tabBar.selectedColor || '#007aff'
pagesJson.tabBar.backgroundColor = pagesJson.tabBar.backgroundColor || '#f7f7fa'
pagesJson.tabBar.backgroundColor = pagesJson.tabBar.backgroundColor || ''
pagesJson.tabBar.borderStyle = pagesJson.tabBar.borderStyle || 'black'
}
......@@ -458,4 +458,4 @@ ${genRegisterPageVueComponentsCode(pageComponents)}
global.__uniRoutes=[${genPageRoutes(pageComponents).concat(genSystemRoutes()).join(',')}]
global.UniApp && new global.UniApp();
`
}
}
{
"name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.0-alpha-29920201113004",
"version": "2.0.0-alpha-30020201218003",
"description": "uni-app pages.json loader",
"main": "lib/index.js",
"repository": {
......@@ -21,7 +21,7 @@
"strip-json-comments": "^2.0.1"
},
"uni-app": {
"compilerVersion": "2.9.9"
"compilerVersion": "3.0.0"
},
"gitHead": "e51484a49748f7bff86bb833763e5dff1522d380"
"gitHead": "c135dec26ebb9c45211964ed038893f252612853"
}
......@@ -32,6 +32,6 @@ export const chooseFile = {
},
extension: {
type: Array,
default: ['*']
default: ['']
}
}
此差异已折叠。
此差异已折叠。
......@@ -81,7 +81,7 @@ function beforeEach (to, from, next, routes) {
if (toId === fromId && to.type !== 'reLaunch') { // 相同页面阻止
// 处理外部修改 history 导致卡在当前页面的问题
if (to.fullPath !== from.fullPath) {
removeKeepAliveInclude.call(this, toName)
addKeepAliveInclude.call(this, toName)
next()
} else {
next(false)
......
......@@ -95,6 +95,15 @@ export default {
})
initClick(this.$el)
initScrollBounce()
let $vm = this
while ($vm) {
const scopeId = $vm.$options._scopeId
if (scopeId) {
this.$refs.indicator.setAttribute(scopeId, '')
}
$vm = $vm.$parent
}
},
methods: {
_setItemHeight (height) {
......
此差异已折叠。
......@@ -89,7 +89,7 @@ export default {
},
autoBlur: {
type: [Boolean, String],
default: true
default: false
}
},
directives: {
......
......@@ -19,4 +19,5 @@ export const VD_SYNC_CALLBACK = 'vdSyncCallback'
export const INVOKE_API = 'invokeApi'
export const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'
export const WEBVIEW_INSERTED = 'webviewInserted'
export const WEBVIEW_REMOVED = 'webviewRemoved'
export const WEBVIEW_REMOVED = 'webviewRemoved'
export const WEBVIEW_ID_PREFIX = 'webviewId'
此差异已折叠。
const eventNames = [
'load',
'close',
'error'
'error',
'adClicked'
]
class FullScreenVideoAd {
......@@ -50,6 +51,9 @@ class FullScreenVideoAd {
this._loadPromiseReject = null
}
})
ad.onAdClicked((e) => {
this._dispatchEvent('adClicked', {})
})
}
load () {
......
......@@ -49,7 +49,7 @@ export function previewImagePlus ({
title: item,
color: itemColor
})),
cancel: '取消'
cancel: ''
}
if (title) {
options.title = title
......
......@@ -52,7 +52,7 @@ const createUploadTaskById = function (uploadTaskId, {
for (const name in header) {
if (hasOwn(header, name)) {
uploader.setRequestHeader(name, header[name])
uploader.setRequestHeader(name, String(header[name]))
}
}
for (const name in formData) {
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册