提交 4b4d5e1f 编写于 作者: Q qiang

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

......@@ -7681,7 +7681,7 @@ var serviceContext = (function () {
return webview
}
function initWebview (webview, routeOptions) {
function initWebview (webview, routeOptions, url = '') {
// 首页或非 nvue 页面
if (webview.id === '1' || !routeOptions.meta.isNVue) {
const webviewStyle = parseWebviewStyle(
......@@ -7689,6 +7689,17 @@ var serviceContext = (function () {
'',
routeOptions
);
if (url) {
const part = url.split('?');
webviewStyle.debugRefresh = {
isTab: routeOptions.meta.isTabBar,
arguments: JSON.stringify({
path: part[0].substr(1),
query: part[1] || ''
})
};
}
if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] updateWebview`, webviewStyle);
}
......@@ -7882,6 +7893,7 @@ var serviceContext = (function () {
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
function registerPage ({
url,
path,
query,
openType,
......@@ -7920,7 +7932,7 @@ var serviceContext = (function () {
console.log(`[uni-app] registerPage`, path, webview.id);
}
initWebview(webview, routeOptions);
initWebview(webview, routeOptions, url);
const route = path.slice(1);
......@@ -7986,6 +7998,7 @@ var serviceContext = (function () {
}
function _navigateTo ({
url,
path,
query,
animationType,
......@@ -7998,6 +8011,7 @@ var serviceContext = (function () {
showWebview(
registerPage({
url,
path,
query,
openType: 'navigate'
......@@ -8032,6 +8046,7 @@ var serviceContext = (function () {
const query = parseQuery(urls[1] || '');
navigate(path, function () {
_navigateTo({
url,
path,
query,
animationType,
......@@ -8041,6 +8056,7 @@ var serviceContext = (function () {
}
function _reLaunch ({
url,
path,
query
}, callbackId) {
......@@ -8054,6 +8070,7 @@ var serviceContext = (function () {
showWebview(
registerPage({
url,
path,
query,
openType: 'reLaunch'
......@@ -8082,6 +8099,7 @@ var serviceContext = (function () {
const query = parseQuery(urls[1] || '');
navigate(path, function () {
_reLaunch({
url,
path,
query
}, callbackId);
......@@ -8089,6 +8107,7 @@ var serviceContext = (function () {
}
function _redirectTo ({
url,
path,
query
}, callbackId) {
......@@ -8099,6 +8118,7 @@ var serviceContext = (function () {
showWebview(
registerPage({
url,
path,
query,
openType: 'redirect'
......@@ -8123,6 +8143,7 @@ var serviceContext = (function () {
const query = parseQuery(urls[1] || '');
navigate(path, function () {
_redirectTo({
url,
path,
query
}, callbackId);
......@@ -8130,6 +8151,7 @@ var serviceContext = (function () {
}
function _switchTab ({
url,
path,
from
}, callbackId) {
......@@ -8180,6 +8202,7 @@ var serviceContext = (function () {
tabBarPage.$getAppWebview().show('none');
} else {
return showWebview(registerPage({
url,
path,
query: {},
openType: 'switchTab'
......@@ -8205,6 +8228,7 @@ var serviceContext = (function () {
const path = url.split('?')[0];
navigate(path, function () {
_switchTab({
url,
path,
from
}, callbackId);
......
const {
getPlatformFilterTag,
normalizeNodeModules
normalizeNodeModules,
jsPreprocessOptions
} = require('@dcloudio/uni-cli-shared/lib/platform')
const preprocessor = require('@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/preprocess')
const FILTER_TAG = getPlatformFilterTag()
function preprocessBlock(block) {
if (block.content) {
block.content = preprocessor.preprocess(block.content, jsPreprocessOptions.context, {
type: jsPreprocessOptions.type
}).trim()
}
return block
}
module.exports = function parseCustomBlocks(descriptor, options) {
if (!descriptor.template || !FILTER_TAG || options.isAppNVue) {
......@@ -23,7 +35,7 @@ module.exports = function parseCustomBlocks(descriptor, options) {
block.attrs.lang === FILTER_TAG
)
) {
modules[block.attrs.module] = block
modules[block.attrs.module] = preprocessBlock(block)
return true
}
if ( // renderjs
......@@ -33,7 +45,7 @@ module.exports = function parseCustomBlocks(descriptor, options) {
block.attrs.lang === 'renderjs'
)
) {
descriptor.renderjs = block
descriptor.renderjs = preprocessBlock(block)
modules[block.attrs.module] = Object.assign({}, block, {
content: ''
})
......
......@@ -25,6 +25,7 @@ import {
} from '../../framework/navigator'
function _navigateTo ({
url,
path,
query,
animationType,
......@@ -37,6 +38,7 @@ function _navigateTo ({
showWebview(
registerPage({
url,
path,
query,
openType: 'navigate'
......@@ -71,6 +73,7 @@ export function navigateTo ({
const query = parseQuery(urls[1] || '')
navigate(path, function () {
_navigateTo({
url,
path,
query,
animationType,
......
......@@ -22,6 +22,7 @@ import {
} from '../../framework/navigator'
function _reLaunch ({
url,
path,
query
}, callbackId) {
......@@ -35,6 +36,7 @@ function _reLaunch ({
showWebview(
registerPage({
url,
path,
query,
openType: 'reLaunch'
......@@ -63,6 +65,7 @@ export function reLaunch ({
const query = parseQuery(urls[1] || '')
navigate(path, function () {
_reLaunch({
url,
path,
query
}, callbackId)
......
......@@ -20,6 +20,7 @@ import {
} from '../../framework/navigator'
function _redirectTo ({
url,
path,
query
}, callbackId) {
......@@ -30,6 +31,7 @@ function _redirectTo ({
showWebview(
registerPage({
url,
path,
query,
openType: 'redirect'
......@@ -54,6 +56,7 @@ export function redirectTo ({
const query = parseQuery(urls[1] || '')
navigate(path, function () {
_redirectTo({
url,
path,
query
}, callbackId)
......
......@@ -23,6 +23,7 @@ import {
import tabBar from '../../framework/tab-bar'
function _switchTab ({
url,
path,
from
}, callbackId) {
......@@ -73,6 +74,7 @@ function _switchTab ({
tabBarPage.$getAppWebview().show('none')
} else {
return showWebview(registerPage({
url,
path,
query: {},
openType: 'switchTab'
......@@ -98,6 +100,7 @@ export function switchTab ({
const path = url.split('?')[0]
navigate(path, function () {
_switchTab({
url,
path,
from
}, callbackId)
......
......@@ -25,6 +25,7 @@ export function getCurrentPages (returnAll) {
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
export function registerPage ({
url,
path,
query,
openType,
......@@ -63,7 +64,7 @@ export function registerPage ({
console.log(`[uni-app] registerPage`, path, webview.id)
}
initWebview(webview, routeOptions)
initWebview(webview, routeOptions, url)
const route = path.slice(1)
......
......@@ -63,7 +63,7 @@ export function createWebview (path, routeOptions) {
return webview
}
export function initWebview (webview, routeOptions) {
export function initWebview (webview, routeOptions, url = '') {
// 首页或非 nvue 页面
if (webview.id === '1' || !routeOptions.meta.isNVue) {
const webviewStyle = parseWebviewStyle(
......@@ -71,6 +71,17 @@ export function initWebview (webview, routeOptions) {
'',
routeOptions
)
if (url) {
const part = url.split('?')
webviewStyle.debugRefresh = {
isTab: routeOptions.meta.isTabBar,
arguments: JSON.stringify({
path: part[0].substr(1),
query: part[1] || ''
})
}
}
if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] updateWebview`, webviewStyle)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册