提交 93d5750d 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -59,6 +59,7 @@ uni 统计配置项
|distribute|Object|App 发布信息,[详见](/collocation/manifest?id=distribute)||
|usingComponents|Boolean|是否启用自定义组件模式,默认为false,[编译模式区别详情](https://ask.dcloud.net.cn/article/35843)|1.9.0+|
|nvueCompiler|String|切换 nvue 编译模式,可选值,`weex` :老编译模式,`uni-app`: 新编译模式,默认为 `weex`[编译模式区别详情](http://ask.dcloud.net.cn/article/36074)|2.0.3+|
|nvueStyleCompiler|String|切换 nvue 样式编译模式,可选值,`weex` :老编译模式,`uni-app`: 新编译模式,默认为 `weex`[编译模式区别详情](https://ask.dcloud.net.cn/article/38751)|3.1.1+|
|renderer|String|可不加载基于 webview 的运行框架,减少包体积、提升启动速度。可选值 `native`| App-nvue 2.2.0+|
|compilerVersion|Number|编译器版本,可选值:2、3 默认 2 [详见](https://ask.dcloud.net.cn/article/36599)|HBuilderX alpha 2.4.4+或HBuilderX 2.5.0+|
|nvueLaunchMode|Number|Nvue 首页启动模式,在 compilerVersion 值为 3 时生效,可选值:normal、fast 默认 normal(HBuilderX alpha 2.4.4-2.4.9 固定为 fast) [详见](https://ask.dcloud.net.cn/article/36749)|2.5.0+|
......
......@@ -10,6 +10,7 @@
|fade-show|Boolean|true|图片显示动画效果|仅App-nvue 2.3.4+ Android有效|
|webp|boolean|false|默认不解析 webP 格式,只支持网络资源|微信小程序2.9.0|
|show-menu-by-longpress|boolean|false|开启长按图片显示识别小程序码菜单|微信小程序2.7.0|
|draggable|boolean|true|鼠标长按是否能拖动图片|仅 H5 平台 3.1.1+ 有效|
|@error|HandleEvent||当错误发生时,发布到 AppService 的事件名,事件对象event.detail = {errMsg: 'something wrong'}||
|@load|HandleEvent||当图片载入完毕时,发布到 AppService 的事件名,事件对象event.detail = {height:'图片高度px', width:'图片宽度px'}| |
......
......@@ -2990,6 +2990,7 @@ function createComponentInstance(vnode, parent, suspense) {
return instance;
}
let currentInstance = null;
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
const setCurrentInstance = (instance) => {
currentInstance = instance;
};
......@@ -3247,7 +3248,7 @@ function defineEmit() {
}
// Core API ------------------------------------------------------------------
const version = "3.0.4";
const version = "3.0.5";
// import deepCopy from './deepCopy'
/**
......@@ -3661,7 +3662,7 @@ function createVueApp(rootComponent, rootProps = null) {
}
function applyOptions$1(options, instance, publicThis) {
Object.keys(options).forEach(name => {
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
......@@ -3737,7 +3738,7 @@ var plugin = {
createMiniProgramApp(instance);
return instance;
};
}
},
};
// @ts-ignore
......@@ -3773,4 +3774,4 @@ function createApp(rootComponent, rootProps = null) {
return createVueApp(rootComponent, rootProps).use(plugin);
}
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createHook$1 as createHook, createVueApp, customRef, defineComponent, defineEmit, defineProps, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createHook$1 as createHook, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
......@@ -69,6 +69,7 @@ module.exports = function (content, map) {
}
Object.assign(appJson.globalStyle, appJson.globalStyle['app-plus'] || {})
pageJson.style = pageJson.style || {}
Object.assign(pageJson.style, pageJson.style['app-plus'] || {})
const pageJsonStyle = Object.assign(appJson.globalStyle, pageJson.style)
if (pageJsonStyle.disableScroll === true) {
......@@ -78,4 +79,4 @@ module.exports = function (content, map) {
this.callback(null,
`<scroll-view :scroll-y="true" :show-scrollbar="${pageJsonStyle.scrollIndicator === 'none' ? 'false' : 'true'}" :enableBackToTop="true" bubble="true" style="flex-direction:column">${content}</scroll-view>`,
map)
}
}
......@@ -83,7 +83,7 @@ if (
const defaultOutputDir = '../../../../dist/' +
(process.env.NODE_ENV === 'production' ? 'build' : 'dev') + '/' +
(process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM)
process.env.UNI_OUTPUT_DEFAULT_DIR = path.resolve(__dirname, defaultOutputDir)
if (process.env.UNI_OUTPUT_DIR && process.env.UNI_OUTPUT_DIR.indexOf('./') === 0) {
process.env.UNI_OUTPUT_DIR = path.resolve(process.cwd(), process.env.UNI_OUTPUT_DIR)
......@@ -243,8 +243,10 @@ if (isNVueCompiler) {
process.env.UNI_USING_NVUE_COMPILER = true
}
if (platformOptions.nvueStyleCompiler !== 'weex') {
if (platformOptions.nvueStyleCompiler === 'uni-app') {
process.env.UNI_USING_NVUE_STYLE_COMPILER = true
} else {
platformOptions.nvueStyleCompiler = 'weex'
}
if (platformOptions.usingComponents === true) {
......@@ -451,4 +453,4 @@ runByHBuilderX && console.log('正在编译中...')
module.exports = {
manifestPlatformOptions: platformOptions
}
}
......@@ -32,6 +32,9 @@ export const chooseFile = {
},
extension: {
type: Array,
default: ['']
default: [''],
validator (extension, params) {
if (extension.length === 0) { return 'param extension should not be empty.' }
}
}
}
......@@ -35,7 +35,7 @@ export const chooseImage = {
type: Array,
default: ['*'],
validator (extension, params) {
if (extension.length === 0) params.extension = ['*']
if (extension.length === 0) { return 'param extension should not be empty.' }
}
}
}
......@@ -22,7 +22,7 @@ export const chooseVideo = {
type: Array,
default: ['*'],
validator (extension, params) {
if (extension.length === 0) params.extension = ['*']
if (extension.length === 0) { return 'param extension should not be empty.' }
}
}
}
......@@ -7,6 +7,7 @@
<img
v-if="contentPath"
:src="contentPath"
:draggable="draggable"
>
<v-uni-resize-sensor
v-if="mode === 'widthFix' || mode === 'heightFix'"
......@@ -39,6 +40,10 @@ export default {
lazyLoad: {
type: [Boolean, String],
default: false
},
draggable: {
type: Boolean,
default: true
}
},
data () {
......
......@@ -8,6 +8,7 @@ const addListenerToElement = function (element, type, callback, capture) {
}
}
}, {
capture,
passive: false
})
}
......@@ -48,6 +49,7 @@ export default {
}
let $eventOld = null
let hasClickListenerOld
let hasTouchStart
let hasMouseDown
addListenerToElement(element, 'touchstart', function ($event) {
......@@ -77,8 +79,20 @@ export default {
return res
}
})
// 阻止点击事件传播,处理拖拽和点击冲突,鼠标移动则添加监听,停止移动则移除监听
const clickEventListener = this.__clickEventListener = function ($event) {
$event.preventDefault()
$event.stopPropagation()
}
const mouseMoveEventListener = this.__mouseMoveEventListener = function ($event) {
if (!hasTouchStart && hasMouseDown && $eventOld) {
// 存在鼠标移动,则在 document 上添加点击监听(好处是不用管具体使用拖拽的是什么元素)
if (!hasClickListenerOld && (Math.abs(x1 - x0) > 2 || Math.abs(y1 - y0) > 2)) {
document.addEventListener('click', clickEventListener, true)
hasClickListenerOld = true
}
// TODO target currentTarget touches changedTouches
const res = fn($event, 'move', $event.pageX, $event.pageY)
x1 = $event.pageX
......@@ -94,15 +108,23 @@ export default {
return fn($event, 'end', $event.changedTouches[0].pageX, $event.changedTouches[0].pageY)
}
})
const mouseUpEventListener = this.__mouseUpEventListener = function ($event) {
const mouseUpEventListener = this.__mouseUpEventListener = ($event) => {
hasMouseDown = false
if (!hasTouchStart && $eventOld) {
// 鼠标抬起,存在监听,则 mouseup 结束后移除就监听事件
if (hasClickListenerOld) {
setTimeout(() => {
document.removeEventListener('click', this.__clickEventListener, true)
hasClickListenerOld = false
}, 0)
}
// TODO target currentTarget touches changedTouches
$eventOld = null
return fn($event, 'end', $event.pageX, $event.pageY)
}
}
document.addEventListener('mouseup', mouseUpEventListener)
addListenerToElement(element, 'touchcancel', function ($event) {
if ($eventOld) {
hasTouchStart = false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册