提交 f3caf8ce 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into v3

# Conflicts:
#	build/build.js
#	src/platforms/app-plus-nvue/service/api/route/util.js
...@@ -41,8 +41,12 @@ service.run('build', { ...@@ -41,8 +41,12 @@ service.run('build', {
entry, entry,
clean: !process.env.UNI_VIEW, clean: !process.env.UNI_VIEW,
mode: process.env.NODE_ENV mode: process.env.NODE_ENV
}).then(function () { }).then(function() {
if (process.env.UNI_UI !== 'true' && process.env.UNI_VIEW !== 'true') { if (
process.env.UNI_WATCH !== 'true' &&
process.env.UNI_UI !== 'true' &&
process.env.UNI_VIEW !== 'true'
) {
generateApiManifest( generateApiManifest(
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)), JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)),
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL)) JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL))
...@@ -58,7 +62,7 @@ if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_WATCH === 'false') { ...@@ -58,7 +62,7 @@ if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_WATCH === 'false') {
const packageJsonPath = path.join(packagePath, 'package.json') const packageJsonPath = path.join(packagePath, 'package.json')
del(path.join(packagePath, '{lib,src}')) del(path.join(packagePath, '{lib,src}'))
.then(() => { .then(() => {
copy([path.join(__dirname, '../{lib,src}/**/*')], packagePath, function (err, file) { copy([path.join(__dirname, '../{lib,src}/**/*')], packagePath, function(err, file) {
if (err) { if (err) {
throw err throw err
} }
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
"wx": true, "wx": true,
"my": true, "my": true,
"swan": true, "swan": true,
"tt": true,
"weex": true, "weex": true,
"__id__": true, "__id__": true,
"__uniConfig": true, "__uniConfig": true,
......
...@@ -436,6 +436,7 @@ function wrapper (methodName, method) { ...@@ -436,6 +436,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
...@@ -519,8 +520,13 @@ function wrapper$1 (webview) { ...@@ -519,8 +520,13 @@ function wrapper$1 (webview) {
return return
} }
const maskColor = webview.__uniapp_mask; const maskColor = webview.__uniapp_mask;
let maskWebview = plus.webview.getWebviewById(webview.__uniapp_mask_id); let maskWebview = webview.__uniapp_mask_id === '0' ? {
maskWebview = maskWebview.parent() || maskWebview;// 再次检测父 setStyle ({ mask }) {
requireNativePlugin('uni-tabview').setMask({
color: mask
});
}
} : plus.webview.getWebviewById(webview.__uniapp_mask_id);
const oldShow = webview.show; const oldShow = webview.show;
const oldHide = webview.hide; const oldHide = webview.hide;
const oldClose = webview.close; const oldClose = webview.close;
......
...@@ -11478,6 +11478,8 @@ Scroller.prototype.isScrolling = function () { ...@@ -11478,6 +11478,8 @@ Scroller.prototype.isScrolling = function () {
if (n.onTouchStart) { if (n.onTouchStart) {
n.onTouchStart(); n.onTouchStart();
} }
event.preventDefault();
} }
}, },
_handleTouchMove: function _handleTouchMove(event) { _handleTouchMove: function _handleTouchMove(event) {
...@@ -21370,6 +21372,26 @@ var Spring = __webpack_require__(42); ...@@ -21370,6 +21372,26 @@ var Spring = __webpack_require__(42);
function onClick(dom, callback) {
var MAX_MOVE = 20;
var hasTouchSupport = navigator.maxTouchPoints;
var x = 0;
var y = 0;
dom.addEventListener(hasTouchSupport ? 'touchstart' : 'mousedown', function (event) {
var info = hasTouchSupport ? event.changedTouches[0] : event;
x = info.clientX;
y = info.clientY;
});
dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', function (event) {
var info = hasTouchSupport ? event.changedTouches[0] : event;
if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
callback(info);
}
});
}
/* harmony default export */ var picker_view_columnvue_type_script_lang_js_ = ({ /* harmony default export */ var picker_view_columnvue_type_script_lang_js_ = ({
name: 'PickerViewColumn', name: 'PickerViewColumn',
mixins: [touchtrack["a" /* default */], scroller["a" /* default */]], mixins: [touchtrack["a" /* default */], scroller["a" /* default */]],
...@@ -21416,7 +21438,8 @@ var Spring = __webpack_require__(42); ...@@ -21416,7 +21438,8 @@ var Spring = __webpack_require__(42);
this.indicatorStyle = $parent.indicatorStyle; this.indicatorStyle = $parent.indicatorStyle;
this.indicatorClass = $parent.indicatorClass; this.indicatorClass = $parent.indicatorClass;
this.maskStyle = $parent.maskStyle; this.maskStyle = $parent.maskStyle;
this.maskClass = $parent.maskClass; // this.__pageRerender = this._pageRerender.bind(this) this.maskClass = $parent.maskClass;
this.deltaY = 0;
}, },
mounted: function mounted() { mounted: function mounted() {
var _this = this; var _this = this;
...@@ -21428,6 +21451,7 @@ var Spring = __webpack_require__(42); ...@@ -21428,6 +21451,7 @@ var Spring = __webpack_require__(42);
_this.update(); _this.update();
}); });
onClick(this.$el, this._handleTap.bind(this));
}, },
methods: { methods: {
_setItemHeight: function _setItemHeight(height) { _setItemHeight: function _setItemHeight(height) {
...@@ -21455,23 +21479,39 @@ var Spring = __webpack_require__(42); ...@@ -21455,23 +21479,39 @@ var Spring = __webpack_require__(42);
} }
} }
}, },
_handleTap: function _handleTap(e) { _handleTap: function _handleTap(_ref) {
if (e.target !== e.currentTarget && !this._scroller.isScrolling()) { var clientY = _ref.clientY;
var t = e.touches && e.touches[0] && e.touches[0].clientY;
var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop; if (!this._scroller.isScrolling()) {
var i = this.$el.getBoundingClientRect(); var rect = this.$el.getBoundingClientRect();
var r = n - i.top - this._height / 2; var r = clientY - rect.top - this.height / 2;
var o = this.indicatorHeight / 2; var o = this.indicatorHeight / 2;
if (!(Math.abs(r) <= o)) { if (!(Math.abs(r) <= o)) {
var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight); var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight);
var s = r < 0 ? -a : a; var s = r < 0 ? -a : a;
this.current += s; var current = Math.min(this.current + s, this.length - 1);
this.current = current = Math.max(current, 0);
this._scroller.scrollTo(this.current * this.indicatorHeight); this._scroller.scrollTo(current * this.indicatorHeight);
} }
} }
}, },
_handleWheel: function _handleWheel($event) {
var deltaY = this.deltaY + $event.deltaY;
if (Math.abs(deltaY) > 10) {
this.deltaY = 0;
var current = Math.min(this.current + (deltaY < 0 ? -1 : 1), this.length - 1);
this.current = current = Math.max(current, 0);
this._scroller.scrollTo(current * this.indicatorHeight);
} else {
this.deltaY = deltaY;
}
$event.preventDefault();
},
setCurrent: function setCurrent(current) { setCurrent: function setCurrent(current) {
if (current !== this.current) { if (current !== this.current) {
this.current = current; this.current = current;
...@@ -21503,14 +21543,14 @@ var Spring = __webpack_require__(42); ...@@ -21503,14 +21543,14 @@ var Spring = __webpack_require__(42);
var _this3 = this; var _this3 = this;
this.$nextTick(function () { this.$nextTick(function () {
var index = Math.max(_this3.length - 1, 0); var current = Math.min(_this3.current, _this3.length - 1);
var current = Math.min(_this3.current, index); current = Math.max(current, 0);
_this3._scroller.update(current * _this3.indicatorHeight, undefined, _this3.indicatorHeight); _this3._scroller.update(current * _this3.indicatorHeight, undefined, _this3.indicatorHeight);
}); });
}, },
_resize: function _resize(_ref) { _resize: function _resize(_ref2) {
var height = _ref.height; var height = _ref2.height;
this.indicatorHeight = height; this.indicatorHeight = height;
} }
}, },
...@@ -21518,7 +21558,7 @@ var Spring = __webpack_require__(42); ...@@ -21518,7 +21558,7 @@ var Spring = __webpack_require__(42);
this.length = this.$slots.default && this.$slots.default.length || 0; this.length = this.$slots.default && this.$slots.default.length || 0;
return createElement('uni-picker-view-column', { return createElement('uni-picker-view-column', {
on: { on: {
tap: this._handleTap wheel: this._handleWheel
} }
}, [createElement('div', { }, [createElement('div', {
ref: 'main', ref: 'main',
......
...@@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) { ...@@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) {
} }
function updateAppJson (name, jsonObj) { function updateAppJson (name, jsonObj) {
updateComponentJson(name, jsonObj) updateComponentJson(name, jsonObj, true, 'App')
} }
function updatePageJson (name, jsonObj) { function updatePageJson (name, jsonObj) {
pageSet.add(name) pageSet.add(name)
updateComponentJson(name, jsonObj) updateComponentJson(name, jsonObj, true, 'Page')
} }
function updateProjectJson (name, jsonObj) { function updateProjectJson (name, jsonObj) {
updateComponentJson(name, jsonObj, false) updateComponentJson(name, jsonObj, false, 'Project')
} }
const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq' const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq'
function updateComponentJson (name, jsonObj, usingComponents = true) { function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Component') {
if (type === 'Component') {
jsonObj.component = true
}
if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
}
}
const oldJsonStr = getJsonFile(name) const oldJsonStr = getJsonFile(name)
if (oldJsonStr) { // update if (oldJsonStr) { // update
if (usingComponents) { // merge usingComponents if (usingComponents) { // merge usingComponents
......
...@@ -836,6 +836,7 @@ function wrapper (methodName, method) { ...@@ -836,6 +836,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
......
...@@ -579,6 +579,7 @@ function wrapper (methodName, method) { ...@@ -579,6 +579,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
......
...@@ -539,6 +539,7 @@ function wrapper (methodName, method) { ...@@ -539,6 +539,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
......
...@@ -536,9 +536,10 @@ const protocols = { ...@@ -536,9 +536,10 @@ const protocols = {
timeout: false timeout: false
} }
}, },
requestPayment: { requestPayment: {
name: tt.canIUse && tt.canIUse('pay') ? 'pay' : 'requestPayment',
args: { args: {
orderInfo: 'data' orderInfo: tt.canIUse && tt.canIUse('pay') ? 'orderInfo' : 'data'
} }
}, },
getFileInfo: { getFileInfo: {
...@@ -630,6 +631,7 @@ function wrapper (methodName, method) { ...@@ -630,6 +631,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
......
...@@ -474,6 +474,7 @@ function wrapper (methodName, method) { ...@@ -474,6 +474,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null); const todoApis = Object.create(null);
const TODOS = [ const TODOS = [
'onTabBarMidButtonTap',
'subscribePush', 'subscribePush',
'unsubscribePush', 'unsubscribePush',
'onPush', 'onPush',
......
...@@ -4,6 +4,24 @@ import scroller from 'uni-mixins/scroller/index' ...@@ -4,6 +4,24 @@ import scroller from 'uni-mixins/scroller/index'
import { Friction } from 'uni-mixins/scroller/Friction' import { Friction } from 'uni-mixins/scroller/Friction'
import { Spring } from 'uni-mixins/scroller/Spring' import { Spring } from 'uni-mixins/scroller/Spring'
function onClick (dom, callback) {
const MAX_MOVE = 20
const hasTouchSupport = navigator.maxTouchPoints
let x = 0
let y = 0
dom.addEventListener(hasTouchSupport ? 'touchstart' : 'mousedown', (event) => {
const info = hasTouchSupport ? event.changedTouches[0] : event
x = info.clientX
y = info.clientY
})
dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', (event) => {
const info = hasTouchSupport ? event.changedTouches[0] : event
if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
callback(info)
}
})
}
export default { export default {
name: 'PickerViewColumn', name: 'PickerViewColumn',
mixins: [touchtrack, scroller], mixins: [touchtrack, scroller],
...@@ -50,7 +68,7 @@ export default { ...@@ -50,7 +68,7 @@ export default {
this.indicatorClass = $parent.indicatorClass this.indicatorClass = $parent.indicatorClass
this.maskStyle = $parent.maskStyle this.maskStyle = $parent.maskStyle
this.maskClass = $parent.maskClass this.maskClass = $parent.maskClass
// this.__pageRerender = this._pageRerender.bind(this) this.deltaY = 0
}, },
mounted: function () { mounted: function () {
this.touchtrack(this.$refs.main, '_handleTrack', true) this.touchtrack(this.$refs.main, '_handleTrack', true)
...@@ -59,6 +77,7 @@ export default { ...@@ -59,6 +77,7 @@ export default {
this.init() this.init()
this.update() this.update()
}) })
onClick(this.$el, this._handleTap.bind(this))
}, },
methods: { methods: {
_setItemHeight (height) { _setItemHeight (height) {
...@@ -81,21 +100,32 @@ export default { ...@@ -81,21 +100,32 @@ export default {
} }
} }
}, },
_handleTap: function (e) { _handleTap: function ({ clientY }) {
if (e.target !== e.currentTarget && !this._scroller.isScrolling()) { if (!this._scroller.isScrolling()) {
var t = e.touches && e.touches[0] && e.touches[0].clientY var rect = this.$el.getBoundingClientRect()
var n = typeof t === 'number' ? t : e.detail.y - document.body.scrollTop var r = clientY - rect.top - this.height / 2
var i = this.$el.getBoundingClientRect()
var r = n - i.top - this._height / 2
var o = this.indicatorHeight / 2 var o = this.indicatorHeight / 2
if (!(Math.abs(r) <= o)) { if (!(Math.abs(r) <= o)) {
var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight) var a = Math.ceil((Math.abs(r) - o) / this.indicatorHeight)
var s = r < 0 ? -a : a var s = r < 0 ? -a : a
this.current += s var current = Math.min(this.current + s, this.length - 1)
this._scroller.scrollTo(this.current * this.indicatorHeight) this.current = current = Math.max(current, 0)
this._scroller.scrollTo(current * this.indicatorHeight)
} }
} }
}, },
_handleWheel ($event) {
const deltaY = this.deltaY + $event.deltaY
if (Math.abs(deltaY) > 10) {
this.deltaY = 0
var current = Math.min(this.current + (deltaY < 0 ? -1 : 1), this.length - 1)
this.current = current = Math.max(current, 0)
this._scroller.scrollTo(current * this.indicatorHeight)
} else {
this.deltaY = deltaY
}
$event.preventDefault()
},
setCurrent: function (current) { setCurrent: function (current) {
if (current !== this.current) { if (current !== this.current) {
this.current = current this.current = current
...@@ -122,8 +152,8 @@ export default { ...@@ -122,8 +152,8 @@ export default {
}, },
update: function () { update: function () {
this.$nextTick(() => { this.$nextTick(() => {
var index = Math.max(this.length - 1, 0) var current = Math.min(this.current, this.length - 1)
var current = Math.min(this.current, index) current = Math.max(current, 0)
this._scroller.update(current * this.indicatorHeight, undefined, this.indicatorHeight) this._scroller.update(current * this.indicatorHeight, undefined, this.indicatorHeight)
}) })
}, },
...@@ -137,10 +167,9 @@ export default { ...@@ -137,10 +167,9 @@ export default {
this.length = (this.$slots.default && this.$slots.default.length) || 0 this.length = (this.$slots.default && this.$slots.default.length) || 0
return createElement('uni-picker-view-column', { return createElement('uni-picker-view-column', {
on: { on: {
tap: this._handleTap wheel: this._handleWheel
} }
}, }, [
[
createElement('div', { createElement('div', {
ref: 'main', ref: 'main',
staticClass: 'uni-picker-view-group' staticClass: 'uni-picker-view-group'
......
...@@ -46,6 +46,7 @@ export default { ...@@ -46,6 +46,7 @@ export default {
if (n.onTouchStart) { if (n.onTouchStart) {
n.onTouchStart() n.onTouchStart()
} }
event.preventDefault()
} }
}, },
_handleTouchMove: function (event) { _handleTouchMove: function (event) {
......
...@@ -319,7 +319,7 @@ export default { ...@@ -319,7 +319,7 @@ export default {
} }
}, },
_resetFormData () { _resetFormData () {
this.valueSync = '' this.valueSync = 0
}, },
_createTime () { _createTime () {
var hours = [] var hours = []
......
...@@ -152,9 +152,10 @@ const protocols = { ...@@ -152,9 +152,10 @@ const protocols = {
timeout: false timeout: false
} }
}, },
requestPayment: { requestPayment: {
name: tt.canIUse && tt.canIUse('pay') ? 'pay' : 'requestPayment',
args: { args: {
orderInfo: 'data' orderInfo: tt.canIUse && tt.canIUse('pay') ? 'orderInfo' : 'data'
} }
}, },
getFileInfo: { getFileInfo: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册