提交 9e01ef68 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -43,7 +43,7 @@ uni.onKeyboardHeightChange(res => {
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|HBuilderX 3.0.8+|x|基础库2.9.2+|x|x|x|x|
|HBuilderX 3.1.0+|x|基础库2.9.2+|x|x|x|x|
**示例代码**
......
......@@ -42,7 +42,7 @@
|函数名|说明|平台差异说明|最低版本|
|:-|:-|:-|:-|
|onInit|监听页面初始化,其参数同 onLoad 参数,为上个页面传递的数据,参数类型为 Object(用于页面传参),触发时机早于 onLoad|百度小程序|3.0.8+|
|onInit|监听页面初始化,其参数同 onLoad 参数,为上个页面传递的数据,参数类型为 Object(用于页面传参),触发时机早于 onLoad|百度小程序|3.1.0+|
|onLoad|监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参),参考[示例](/api/router?id=navigateto)|||
|onShow|监听页面显示。页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面|||
|onReady|监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发|||
......
......@@ -28,7 +28,7 @@
|@focus|EventHandle||输入框聚焦时触发,event.detail = { value, height },height 为键盘高度|仅微信小程序、App(2.2.3+) 、QQ小程序支持 height|
|@blur|EventHandle||输入框失去焦点时触发,event.detail = {value: value}||
|@confirm|EventHandle||点击完成按钮时触发,event.detail = {value: value}| |
|@keyboardheightchange|eventhandle||键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}|微信小程序基础库2.7.0+、App 3.0.8+|
|@keyboardheightchange|eventhandle||键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}|微信小程序基础库2.7.0+、App 3.1.0+|
**Tips**
......
......@@ -74,7 +74,7 @@
}
}
// 百度小程序 注意是 usingSwanComponents 不是 usingComponents(HBuilder 3.0.8+ 可以使写为 usingComponents)
// 百度小程序 注意是 usingSwanComponents 不是 usingComponents(HBuilder 3.1.0+ 可以使写为 usingComponents)
{
"path": "pages/index/index",
"style": {
......
......@@ -30,7 +30,7 @@
|@linechange|EventHandle||输入框行数变化时调用,event.detail = {height: 0, heightRpx: 0, lineCount: 0}|字节跳动小程序不支持,nvue ios暂不支持|
|@input|EventHandle||当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上||
|@confirm|EventHandle||点击完成时, 触发 confirm 事件,event.detail = {value: value}|微信小程序、百度小程序、QQ小程序|
|@keyboardheightchange|Eventhandle||键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}|微信小程序基础库2.7.0+、App 3.0.8+|
|@keyboardheightchange|Eventhandle||键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}|微信小程序基础库2.7.0+、App 3.1.0+|
**confirm-type 有效值**
......
......@@ -35,8 +35,9 @@
|vslide-gesture-in-fullscreen|Boolean|true|在全屏模式下,是否开启亮度与音量调节手势|微信小程序|
|ad-unit-id|String||视频前贴广告单元ID,更多详情可参考开放能力[视频前贴广告](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/ad/video-patch-ad.html)|微信小程序|
|poster-for-crawler|String||用于给搜索等场景作为视频封面展示,建议使用无播放 icon 的视频封面图,只支持网络地址|微信小程序|
|codec|String|hardware|解码器选择,hardware:原生解码器,software:ffmpeg解码器|App 3.0.9+|
|http-cache|Boolean|true|是否对 http、https 链接,开启缓存|App 3.0.9+|
|codec|String|hardware|解码器选择,hardware:硬解码(硬解码可以增加解码算力,提高视频清晰度。部分硬件可能存在兼容性问题);software:ffmpeg 软解码;|App 3.1.0+|
|http-cache|Boolean|true|是否对 http、https 视频源开启本地缓存。缓存策略:开启了此开关的视频源,在视频播放时会在本地保存缓存文件,如果本地缓存池已超过100M,在进行缓存前会清空之前的缓存|App 3.1.0+|
|play-strategy|Number|0| 播放策略,0:默认策略;1:平滑播放模式(开启了此模式的视频源 会加大缓冲力度,采用open sl解码音频,避免音视频脱轨的问题,可能会降低首屏展现速度。 适用于在线播放高清视频的场景。);|App 3.1.0+|
|@play|EventHandle||当开始/继续播放时触发play事件|字节跳动小程序不支持|
|@pause|EventHandle||当暂停播放时触发 pause 事件|字节跳动小程序不支持|
|@ended|EventHandle||当播放到末尾时触发 ended 事件|字节跳动小程序不支持|
......
......@@ -14,7 +14,19 @@
- 方式1:把原生小程序转换为uni-app源码。有各种转换工具,[详见](translate.md)
- 方式2:新建一个uni-app项目,把原生小程序的代码变成小程序组件,进而整合到uni-app项目下。uni-app支持使用小程序wxml组件,[参考](frame.md?id=小程序组件支持)
- 方式3:原生开发的小程序仍保留,部分新功能使用uni-app开发。这个场景有三方开发者提供了插件,[参考](https://ext.dcloud.net.cn/plugin?id=1560)
- 方式3:原生开发的小程序仍保留,部分新功能使用uni-app开发。
* 官方提供了发行混合分包的功能
+ 在 HBuilderX 3.1.0+ 中点击发行小程序的菜单,勾选发行混合分包,填写分包目录名称,打包后,将对应目录文件拷贝至已有小程序中,需要自己补充原小程序app.json中的页面或分包配置
+ 在 cli 中,执行命令:`npm run build:mp-weixin -- --subpackage=sub1``yarn build:mp-weixin --subpackage=sub1`
注意:
* 发行混合分包后,App.vue中的onLaunch,onShow等应用级别生命周期不再触发。
* 开发时需要将资源(图片,css,js等)、页面的绝对路径调整为相对路径,否则打包到原生小程序中时,可能出现路径查找错误。
* 需要自己把页面或分包配置添加到已有小程序的app.json中。
* 目前支持微信小程序,百度小程序,支付宝小程序,字节跳动小程序,QQ小程序。
* 三方开发者插件,[参考](https://ext.dcloud.net.cn/plugin?id=1560)
如果想充分发挥uni-app的跨端特性,编译到各种其他小程序平台,建议使用方案1。
......
......@@ -8,7 +8,9 @@
- 在选择器方面支持的较少,只支持简单的```class="classA"```
- class 进行绑定时只支持数组语法。
- 不支持媒体查询
- 不支持复合样式,不支持简写
- 不支持 class 以外的选择器
- 不支持组合选择器(3.1.0+ 开始支持)
- 不支持简写样式(3.1.0+ 开始支持)
- 不能在 style 中引入字体文件
- 布局不能使用百分比,如```width:100%```
- 有些web的css属性在nvue里无法支持,比如背景图。但可以使用image组件和层级来实现类似web中的背景效果。因为原生开发本身也没有web这种背景图概念
......@@ -18,11 +20,20 @@
下面有些正确和错误的写法示例对比:
- 选择器仅支持class 选择器
- 选择器类型仅支持 class 选择器
```css
/* 错误 */
#id {}
/* 正确 */
.class {}
```
- 仅支持单个选择器(3.1.0+ 开始支持组合选择器)
```css
/* 错误 */
.a .b .c {}
.a > .b {}
......@@ -30,7 +41,7 @@
.class {}
```
- 不支持简写
- 不支持简写样式(3.1.0+ 开始支持更多简写样式)
```css
/* 错误 */
......
......@@ -588,7 +588,7 @@ db.collection('order,book')
### 对字段操作后返回@operator
`HBuilderX 3.0.8`起,clientDB支持对字段进行一定的操作之后再返回,详细可用的方法列表请参考:[聚合操作符](uniCloud/clientdb.md?id=aggregate-operator)
`HBuilderX 3.1.0`起,clientDB支持对字段进行一定的操作之后再返回,详细可用的方法列表请参考:[聚合操作符](uniCloud/clientdb.md?id=aggregate-operator)
例:数据表class内有以下数据
......@@ -1146,7 +1146,7 @@ db.collection("department").get({
### 分组统计@groupby
`HBuilderX 3.0.8`起,clientDB支持分组对数据进行分组统计(groupBy)
`HBuilderX 3.1.0`起,clientDB支持分组对数据进行分组统计(groupBy)
如果数据库`score`表为某次比赛统计的分数数据,每条记录为一个学生的分数
......@@ -1384,7 +1384,7 @@ const res = await db.collection('score')
distinct方法将按照field方法指定的字段进行去重(如果field内未指定_id,不会按照_id去重)
> `HBuilderX 3.0.8`+
> `HBuilderX 3.1.0`+
```js
const res = await db.collection('table1')
......
......@@ -27,6 +27,17 @@ describe('mp:compiler-extra', () => {
}
}
)
assertCodegen(
/* eslint-disable no-template-curly-in-string */
'<view v-for="(item, index) in a.test()" :key="index">{{item}}</view>',
'<block wx:for="{{a.test()}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view>{{item}}</view></block>',
'with(this){}', {
filterModules: {
t: {},
a: {}
}
}
)
})
it('generate scopeId', () => {
......
......@@ -100,7 +100,11 @@ describe('mp:compiler-mp-alipay', () => {
)
assertCodegen(
'<p class="static" :class="[{ active: isActive }, errorClass]">5</p>',
'<view class="{{(((\'static _p\')+\' \'+[(isActive)?\'active\':\'\'])+\' \'+errorClass)}}">5</view>'
'<view class="{{(((\'static _p\')+\' \'+((isActive)?\'active\':\'\'))+\' \'+errorClass)}}">5</view>'
)
assertCodegen(
'<p class="static" :class="[{ active: isActive, disabled: isDisabled }, errorClass]">52</p>',
'<view class="{{(((\'static _p\')+\' \'+(((isActive)?\'active\':\'\')+\' \'+((isDisabled)?\'disabled\':\'\')))+\' \'+errorClass)}}">52</view>'
)
assertCodegen(
'<div class="container" :class="computedClassObject">6</div>',
......@@ -123,6 +127,10 @@ describe('mp:compiler-mp-alipay', () => {
'<p :class="classStr1 || classStr2" class="bg">9</p>',
'<view class="{{((\'bg _p\')+\' \'+(classStr1||classStr2))}}">9</view>'
)
assertCodegen(
'<p class="static" :class="[{ active: isActive }, errorClass, [flex, \'flex-row\']]">10</p>',
'<view class="{{((((\'static _p\')+\' \'+((isActive)?\'active\':\'\'))+\' \'+errorClass)+\' \'+((flex)+\' \'+\'flex-row\'))}}">10</view>'
)
})
it('generate getPhoneNumber', () => {
......
......@@ -48,7 +48,11 @@ describe('mp:compiler-mp-toutiao', () => {
)
assertCodegen(
'<p class="static" :class="[{ active: isActive }, errorClass]">5</p>',
'<view class="{{(((\'static _p\')+\' \'+[(isActive)?\'active\':\'\'])+\' \'+errorClass)}}">5</view>'
'<view class="{{(((\'static _p\')+\' \'+((isActive)?\'active\':\'\'))+\' \'+errorClass)}}">5</view>'
)
assertCodegen(
'<p class="static" :class="[{ active: isActive, disabled: isDisabled }, errorClass]">52</p>',
'<view class="{{(((\'static _p\')+\' \'+(((isActive)?\'active\':\'\')+\' \'+((isDisabled)?\'disabled\':\'\')))+\' \'+errorClass)}}">52</view>'
)
assertCodegen(
'<div class="container" :class="computedClassObject">6</div>',
......@@ -71,6 +75,10 @@ describe('mp:compiler-mp-toutiao', () => {
'<p :class="classStr1 || classStr2" class="bg">9</p>',
'<view class="{{((\'bg _p\')+\' \'+(classStr1||classStr2))}}">9</view>'
)
assertCodegen(
'<p class="static" :class="[{ active: isActive }, errorClass, [flex, \'flex-row\']]">10</p>',
'<view class="{{((((\'static _p\')+\' \'+((isActive)?\'active\':\'\'))+\' \'+errorClass)+\' \'+((flex)+\' \'+\'flex-row\'))}}">10</view>'
)
})
it('generate v-show directive', () => {
......
......@@ -16,7 +16,8 @@ const {
traverseKey,
processMemberExpression,
getForIndexIdentifier,
isSimpleObjectExpression
isSimpleObjectExpression,
traverseFilter
} = require('../../util')
const getMemberExpr = require('./member-expr')
......@@ -185,7 +186,7 @@ module.exports = function traverseRenderList (path, state) {
}
})
}
} else if (forPath.isCallExpression() || (forPath.isObjectExpression() && !isSimpleObjectExpression(forPath.node))) {
} else if ((forPath.isCallExpression() && !traverseFilter(forPath.node.callee, state)) || (forPath.isObjectExpression() && !isSimpleObjectExpression(forPath.node))) {
forPath.replaceWith(getMemberExpr(forPath, IDENTIFIER_FOR, forPath.node, forState))
} else {
forPath.traverse(require('./visitor'), forState)
......
......@@ -4,10 +4,10 @@
:disable-scroll="disableScroll"
v-on="_listeners"
>
<canvas
ref="canvas"
width="300"
height="150"
<canvas
ref="canvas"
width="300"
height="150"
/>
<div
style="
......@@ -21,9 +21,9 @@
>
<slot />
</div>
<v-uni-resize-sensor
ref="sensor"
@resize="_resize"
<v-uni-resize-sensor
ref="sensor"
@resize="_resize"
/>
</uni-canvas>
</template>
......@@ -311,9 +311,13 @@ export default {
image.ready = true
}
// 安卓 WebView 本地路径
if (__PLATFORM__ === 'app-plus' && navigator.vendor === 'Google Inc.' && src.indexOf('file://') === 0) {
image.crossOrigin = 'anonymous'
// 安卓 WebView 除本地路径无跨域问题
if (__PLATFORM__ === 'app-plus' && navigator.vendor === 'Google Inc.') {
if (src.indexOf('file://') === 0) {
image.crossOrigin = 'anonymous'
}
image.src = src
return
}
getSameOriginUrl(src).then(src => {
image.src = src
......
......@@ -48,6 +48,6 @@ export function getSameOriginUrl (url) {
if (window.webkit && window.webkit.messageHandlers) {
return getBase64(url)
}
return url
return plus.io.convertLocalFileSystemURL(url)
})
}
<template>
<uni-video v-on="$listeners">
<div
ref="container"
class="uni-video-container"
<div
ref="container"
class="uni-video-container"
/>
<div class="uni-video-slot">
<slot />
......@@ -59,7 +59,8 @@ const attrs = [
'showCenterPlayBtn',
'showLoading',
'codec',
'httpCache'
'httpCache',
'playStrategy'
]
export default {
......@@ -159,6 +160,10 @@ export default {
httpCache: {
type: [Boolean, String],
default: false
},
playStrategy: {
type: [Number, String],
default: 0
}
},
computed: {
......
......@@ -1766,6 +1766,12 @@ assign-symbols@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
ast-types@0.14.2:
version "0.14.2"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.2.tgz#600b882df8583e3cd4f2df5fa20fa83759d4bdfd"
dependencies:
tslib "^2.0.1"
astral-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
......@@ -3218,7 +3224,7 @@ domain-browser@^1.1.1:
version "1.2.0"
resolved "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
domelementtype@1, domelementtype@^1.3.1:
domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1:
version "1.3.1"
resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f"
......@@ -3601,7 +3607,7 @@ espree@^6.1.2:
acorn-jsx "^5.2.0"
eslint-visitor-keys "^1.1.0"
esprima@^4.0.0, esprima@^4.0.1:
esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0:
version "4.0.1"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
......@@ -6233,6 +6239,10 @@ multicast-dns@^6.0.1:
dns-packet "^1.3.1"
thunky "^1.0.2"
mustache@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.1.0.tgz#8c1b042238a982d2eb2d30efc6c14296ae3f699d"
mute-stream@0.0.8:
version "0.0.8"
resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
......@@ -7490,6 +7500,15 @@ realpath-native@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz#7377ac429b6e1fd599dc38d08ed942d0d7beb866"
recast@^0.20.4:
version "0.20.4"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.20.4.tgz#db55983eac70c46b3fff96c8e467d65ffb4a7abc"
dependencies:
ast-types "0.14.2"
esprima "~4.0.0"
source-map "~0.6.1"
tslib "^2.0.1"
regenerate-unicode-properties@^8.2.0:
version "8.2.0"
resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec"
......@@ -8269,6 +8288,17 @@ strict-uri-encode@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
stricter-htmlparser2@^3.9.6:
version "3.9.6"
resolved "https://registry.yarnpkg.com/stricter-htmlparser2/-/stricter-htmlparser2-3.9.6.tgz#fd195f5e4bc0989c6b15fc79eca85c6401bb5045"
dependencies:
domelementtype "^1.3.0"
domutils "^1.5.1"
entities "^1.1.1"
inherits "^2.0.1"
readable-stream "^2.0.2"
x-domhandler "^2.4.2"
string-length@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837"
......@@ -8712,6 +8742,10 @@ tslib@^1.9.0:
version "1.11.1"
resolved "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
tslib@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
......@@ -9334,6 +9368,12 @@ ws@^7.0.0, ws@^7.2.3:
version "7.2.3"
resolved "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz#a5411e1fb04d5ed0efee76d26d5c46d830c39b46"
x-domhandler@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/x-domhandler/-/x-domhandler-2.4.2.tgz#21afb2d71977118688e49e05c30894497ce3d5e9"
dependencies:
domelementtype "1"
xml-name-validator@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册