提交 edecd867 编写于 作者: Q qiang

Merge branch 'dev' into alpha

# Conflicts:
#	src/core/view/components/swiper/index.vue
......@@ -244,8 +244,9 @@ const third = [
'sendNativeEvent',
'preloadPage',
'unPreloadPage',
'loadSubPackage',
'sendHostEvent'
'loadSubPackage',
'sendHostEvent',
'navigateToMiniProgram'
]
const ad = [
......@@ -272,4 +273,4 @@ const apis = [
...ad
]
module.exports = apis
module.exports = apis
......@@ -255,8 +255,9 @@ var serviceContext = (function () {
'sendNativeEvent',
'preloadPage',
'unPreloadPage',
'loadSubPackage',
'sendHostEvent'
'loadSubPackage',
'sendHostEvent',
'navigateToMiniProgram'
];
const ad = [
......@@ -9229,31 +9230,64 @@ var serviceContext = (function () {
});
}
function onWebviewPopGesture (webview) {
function onWebviewPopGesture(webview) {
let popStartStatusBarStyle;
webview.addEventListener('popGesture', e => {
if (e.type === 'start') {
// 设置下一个页面的 statusBarStyle
const pages = getCurrentPages();
const page = pages[pages.length - 2];
const page = pages[pages.length - 2];
popStartStatusBarStyle = lastStatusBarStyle;
const statusBarStyle = page && page.$page.meta.statusBarStyle;
statusBarStyle && setStatusBarStyle(statusBarStyle);
} else if (e.type === 'end' && !e.result) {
// 拖拽未完成,设置为当前状态栏前景色
setStatusBarStyle(popStartStatusBarStyle);
} else if (e.type === 'end' && e.result) {
} else if (e.type === 'end' && e.result) {
const pages = getCurrentPages();
const page = pages[pages.length - 1];
page && page.$remove();
setStatusBarStyle();
UniServiceJSBridge.emit('onAppRoute', {
type: 'navigateBack'
});
if (page && isDirectPage(page)) {
reLaunchEntryPage();
} else {
UniServiceJSBridge.emit('onAppRoute', {
type: 'navigateBack'
});
}
}
});
}
/**
* 是否处于直达页面
* @param page
* @returns
*/
function isDirectPage(page) {
return (
__uniConfig.realEntryPagePath &&
page.$page.route === __uniConfig.entryPagePath
)
}
/**
* 重新启动到首页
*/
function reLaunchEntryPage() {
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath;
delete __uniConfig.realEntryPagePath;
uni.reLaunch({
url: addLeadingSlash(__uniConfig.entryPagePath),
});
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str
}
let preloadWebview;
......@@ -9757,6 +9791,64 @@ var serviceContext = (function () {
return pageVm
}
const extend = Object.assign;
function createLaunchOptions () {
return {
path: '',
query: {},
scene: 1001,
referrerInfo: {
appId: '',
extraData: {}
}
}
}
const enterOptions = createLaunchOptions();
const launchOptions = createLaunchOptions();
function initLaunchOptions ({
path,
query,
referrerInfo
}) {
extend(launchOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
});
extend(enterOptions, launchOptions);
return launchOptions
}
function parseRedirectInfo () {
const weexPlus = weex.requireModule('plus');
if (weexPlus.getRedirectInfo) {
const {
path,
query,
extraData,
userAction,
fromAppid
} =
weexPlus.getRedirectInfo() || {};
const referrerInfo = {
appId: fromAppid,
extraData: {}
};
if (extraData) {
referrerInfo.extraData = extraData;
}
return {
path: path || '',
query: query ? '?' + query : '',
referrerInfo,
userAction
}
}
}
let isInitEntryPage = false;
function initEntryPage () {
......@@ -9771,9 +9863,16 @@ var serviceContext = (function () {
const weexPlus = weex.requireModule('plus');
if (weexPlus.getRedirectInfo) {
const info = weexPlus.getRedirectInfo() || {};
entryPagePath = info.path;
entryPageQuery = info.query ? ('?' + info.query) : '';
const {
path,
query,
referrerInfo
} = parseRedirectInfo();
if (path) {
entryPagePath = path;
entryPageQuery = query;
}
__uniConfig.referrerInfo = referrerInfo;
} else {
const argsJsonStr = plus.runtime.arguments;
if (!argsJsonStr) {
......@@ -21997,11 +22096,11 @@ var serviceContext = (function () {
}
function initAppLaunch (appVm) {
const args = {
const args = initLaunchOptions({
path: __uniConfig.entryPagePath,
query: {},
scene: 1001
};
query: __uniConfig.entryPageQuery,
referrerInfo: __uniConfig.referrerInfo
});
callAppHook(appVm, 'onLaunch', args);
callAppHook(appVm, 'onShow', args);
......
......@@ -6,7 +6,7 @@
"see": "看",
"platform": "平台",
"plugin": "插件",
"performingHotReload": "正在热重载...",
"performingHotReload": "正在差量编译...",
"cliShared.parsingFailed": "解析失败",
"cliShared.doesNotExist": "不存在",
"cliShared.pagesJsonError": "pages.json 页面配置错误,已被忽略,查看文档: {{0}}",
......
......@@ -147,7 +147,7 @@ export default {
setBackgroundTextStyle () {
// TODO h5 app-plus 暂不支持
// #ifdef MP
uni.setBackgroundTextStyle({
uni.setBackgroundTextStyle && uni.setBackgroundTextStyle({
textStyle: this.backgroundTextStyle
})
// #endif
......@@ -155,7 +155,7 @@ export default {
setBackgroundColor () {
// TODO h5 app-plus 暂不支持
// #ifdef MP
uni.setBackgroundColor({
uni.setBackgroundColor && uni.setBackgroundColor({
backgroundColor: this.backgroundColor,
backgroundColorTop: this.backgroundColorTop,
backgroundColorBottom: this.backgroundColorBottom
......
......@@ -17,7 +17,26 @@ function getShadowCss () {
if (process.env.UNI_PLATFORM === 'h5') {
tagName = 'body'
}
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}`
const cdn = getShadowCdn()
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}`
}
const cdns = {
'mp-weixin': 1,
'mp-alipay': 2,
'mp-baidu': 3,
'mp-toutiao': 4,
'mp-qq': 5,
'mp-360': 7,
'mp-dingtalk': 8,
'mp-kuaishou': 9,
'mp-lark': 10,
'quickapp-webview-huawei': 200,
'quickapp-webview-union': 201
}
function getShadowCdn () {
const index = cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
return `https://cdn${index}.dcloud.net.cn`
}
// 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在
......@@ -34,7 +53,8 @@ module.exports = {
normalizeNodeModules,
isInHBuilderX,
isInHBuilderXAlpha,
runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '', 'weapp-tools')),
runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '',
'weapp-tools')),
getFlexDirection (json) {
let flexDir = 'column'
if (json && json.nvue && json.nvue['flex-direction']) {
......@@ -129,7 +149,7 @@ module.exports = {
if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
tagName = 'image'
}
return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
return `<${tagName} src="${getShadowCdn()}/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
},
getPlatformScss () {
return SCSS
......@@ -141,7 +161,9 @@ module.exports = {
return {
sourceType: 'module',
plugins: [
['pipelineOperator', { proposal: 'minimal' }],
['pipelineOperator', {
proposal: 'minimal'
}],
'doExpressions',
'optionalChaining',
'typescript',
......@@ -152,4 +174,4 @@ module.exports = {
]
}
}
}
}
......@@ -84,7 +84,8 @@ const plugins = [
UNI_PLATFORM: JSON.stringify(process.env.UNI_PLATFORM),
VUE_APP_PLATFORM: JSON.stringify(process.env.UNI_PLATFORM),
UNI_CLOUD_PROVIDER: process.env.UNI_CLOUD_PROVIDER,
HBX_USER_TOKEN: JSON.stringify(process.env.HBX_USER_TOKEN || ''),
UNICLOUD_DEBUG: process.env.UNICLOUD_DEBUG,
RUN_BY_HBUILDERX: process.env.RUN_BY_HBUILDERX,
UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT)
}
}),
......@@ -388,4 +389,4 @@ module.exports = function () {
zlib: false
}
}
}
}
......@@ -4087,10 +4087,10 @@ function updateChildComponent (
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// fixed by xxxxxx update properties(mp runtime)
vm._$updateProperties && vm._$updateProperties(vm);
// update listeners
listeners = listeners || emptyObject;
var oldListeners = vm.$options._parentListeners;
......@@ -4621,7 +4621,7 @@ function initProps (vm, propsOptions) {
}
//fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
if(
key === 'value' &&
key === 'value' &&
Array.isArray(vm.$options.behaviors) &&
vm.$options.behaviors.indexOf('uni://form-field') !== -1
){
......@@ -4633,7 +4633,7 @@ function initProps (vm, propsOptions) {
var $parent = vm.$parent;
while($parent){
if($parent.__next_tick_pending){
return
return
}
$parent = $parent.$parent;
}
......@@ -4965,10 +4965,10 @@ function initMixin (Vue) {
initEvents(vm);
initRender(vm);
callHook(vm, 'beforeCreate');
!vm._$fallback && initInjections(vm); // resolve injections before data/props
!vm._$fallback && initInjections(vm); // resolve injections before data/props
initState(vm);
!vm._$fallback && initProvide(vm); // resolve provide after data/props
!vm._$fallback && callHook(vm, 'created');
!vm._$fallback && callHook(vm, 'created');
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
......@@ -5694,7 +5694,7 @@ function mountComponent$1(
}
}
}
!vm._$fallback && callHook(vm, 'beforeMount');
var updateComponent = function () {
......@@ -5893,14 +5893,16 @@ function internalMixin(Vue) {
if (!target) {
target = this;
}
target[key] = value;
// 解决动态属性添加
Vue.set(target, key, value)
};
Vue.prototype.__set_sync = function(target, key, value) {
if (!target) {
target = this;
}
target[key] = value;
// 解决动态属性添加
Vue.set(target, key, value)
};
Vue.prototype.__get_orig = function(item) {
......@@ -6033,7 +6035,7 @@ Vue.prototype.__patch__ = patch;
// public mount method
Vue.prototype.$mount = function(
el ,
hydrating
hydrating
) {
return mountComponent$1(this, el, hydrating)
};
......
......@@ -56,6 +56,7 @@ function webpackImporter(resourcePath, resolve, addNormalizedDependency) {
// Add the resolvedFilename as dependency. Although we're also using stats.includedFiles, this might come
// in handy when an error occurs. In this case, we don't get stats.includedFiles from node-sass.
addNormalizedDependency(resolvedFile);
// fixed by xxxxxx
const file = resolvedFile.replace(matchCss, '')
if (fs.existsSync(file)) {
const contents = fs.readFileSync(file, 'utf8')
......
......@@ -47,9 +47,11 @@ function addSubPackagesRequire (compilation) {
name.indexOf(root + '/') === 0 &&
name !== subPackageVendorPath
) {
const source =
`require('${normalizePath(path.relative(path.dirname(name), subPackageVendorPath))}');` +
compilation.assets[name].source()
let relativePath = normalizePath(path.relative(path.dirname(name), subPackageVendorPath))
if (!relativePath.startsWith('.')) {
relativePath = './' + relativePath
}
const source = `require('${relativePath}');` + compilation.assets[name].source()
compilation.assets[name] = {
size () {
......
......@@ -444,13 +444,6 @@ export default {
position -= length
}
} else if (n > 0) {
/**
* current -> 1
* position -> 2
* length -> 3
*
* position -> -1
*/
for (; position > current;) {
position -= length
}
......
......@@ -45,6 +45,10 @@ import {
backbuttonListener
} from './backbutton'
import {
initLaunchOptions
} from './utils'
let appCtx
const defaultApp = {
......@@ -143,11 +147,11 @@ function onPlusMessage (e) {
}
function initAppLaunch (appVm) {
const args = {
const args = initLaunchOptions({
path: __uniConfig.entryPagePath,
query: {},
scene: 1001
}
query: __uniConfig.entryPageQuery,
referrerInfo: __uniConfig.referrerInfo
})
callAppHook(appVm, 'onLaunch', args)
callAppHook(appVm, 'onShow', args)
......
import {
parseRedirectInfo
} from './utils'
function parseRoutes (config) {
__uniRoutes.length = 0
/* eslint-disable no-mixed-operators */
......@@ -51,9 +55,16 @@ export function initEntryPage () {
const weexPlus = weex.requireModule('plus')
if (weexPlus.getRedirectInfo) {
const info = weexPlus.getRedirectInfo() || {}
entryPagePath = info.path
entryPageQuery = info.query ? ('?' + info.query) : ''
const {
path,
query,
referrerInfo
} = parseRedirectInfo()
if (path) {
entryPagePath = path
entryPageQuery = query
}
__uniConfig.referrerInfo = referrerInfo
} else {
const argsJsonStr = plus.runtime.arguments
if (!argsJsonStr) {
......@@ -90,4 +101,4 @@ export function initEntryPage () {
if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] entryPagePath(${entryPagePath + entryPageQuery})`)
}
}
}
import {
parseQuery
} from 'uni-shared'
const extend = Object.assign
function createLaunchOptions () {
return {
path: '',
query: {},
scene: 1001,
referrerInfo: {
appId: '',
extraData: {}
}
}
}
const enterOptions = createLaunchOptions()
const launchOptions = createLaunchOptions()
export function getLaunchOptions () {
return launchOptions
}
export function getEnterOptions () {
return enterOptions
}
export function initEnterOptions ({
path,
query,
referrerInfo
}) {
extend(enterOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
})
}
export function initLaunchOptions ({
path,
query,
referrerInfo
}) {
extend(launchOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
})
extend(enterOptions, launchOptions)
return launchOptions
}
export function parseRedirectInfo () {
const weexPlus = weex.requireModule('plus')
if (weexPlus.getRedirectInfo) {
const {
path,
query,
extraData,
userAction,
fromAppid
} =
weexPlus.getRedirectInfo() || {}
const referrerInfo = {
appId: fromAppid,
extraData: {}
}
if (extraData) {
referrerInfo.extraData = extraData
}
return {
path: path || '',
query: query ? '?' + query : '',
referrerInfo,
userAction
}
}
}
import {
import {
lastStatusBarStyle,
setStatusBarStyle
} from '../../bridge'
export function onWebviewPopGesture (webview) {
export function onWebviewPopGesture (webview) {
let popStartStatusBarStyle
webview.addEventListener('popGesture', e => {
if (e.type === 'start') {
// 设置下一个页面的 statusBarStyle
const pages = getCurrentPages()
const page = pages[pages.length - 2]
const page = pages[pages.length - 2]
popStartStatusBarStyle = lastStatusBarStyle
const statusBarStyle = page && page.$page.meta.statusBarStyle
statusBarStyle && setStatusBarStyle(statusBarStyle)
} else if (e.type === 'end' && !e.result) {
// 拖拽未完成,设置为当前状态栏前景色
setStatusBarStyle(popStartStatusBarStyle)
} else if (e.type === 'end' && e.result) {
} else if (e.type === 'end' && e.result) {
const pages = getCurrentPages()
const page = pages[pages.length - 1]
page && page.$remove()
setStatusBarStyle()
UniServiceJSBridge.emit('onAppRoute', {
type: 'navigateBack'
})
if (page && isDirectPage(page)) {
reLaunchEntryPage()
} else {
UniServiceJSBridge.emit('onAppRoute', {
type: 'navigateBack'
})
}
}
})
}
/**
* 是否处于直达页面
* @param page
* @returns
*/
function isDirectPage (page) {
return (
__uniConfig.realEntryPagePath &&
page.$page.route === __uniConfig.entryPagePath
)
}
/**
* 重新启动到首页
*/
function reLaunchEntryPage () {
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath
delete __uniConfig.realEntryPagePath
uni.reLaunch({
url: addLeadingSlash(__uniConfig.entryPagePath)
})
}
function hasLeadingSlash (str) {
return str.indexOf('/') === 0
}
function addLeadingSlash (str) {
return hasLeadingSlash(str) ? str : '/' + str
}
......@@ -29,6 +29,7 @@ export function setClipboardData ({
textarea.focus()
textarea.select()
const result = document.execCommand('Copy', false, null)
textarea.blur()
if (result) {
return {
errMsg: 'setClipboardData:ok'
......
......@@ -462,7 +462,7 @@ export default {
case mode.MULTISELECTOR:
{
if (!Array.isArray(val)) {
val = []
val = this.valueArray
}
if (!Array.isArray(this.valueSync)) {
this.valueSync = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册