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

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

...@@ -7681,7 +7681,7 @@ var serviceContext = (function () { ...@@ -7681,7 +7681,7 @@ var serviceContext = (function () {
return webview return webview
} }
function initWebview (webview, routeOptions) { function initWebview (webview, routeOptions, url = '') {
// 首页或非 nvue 页面 // 首页或非 nvue 页面
if (webview.id === '1' || !routeOptions.meta.isNVue) { if (webview.id === '1' || !routeOptions.meta.isNVue) {
const webviewStyle = parseWebviewStyle( const webviewStyle = parseWebviewStyle(
...@@ -7689,6 +7689,17 @@ var serviceContext = (function () { ...@@ -7689,6 +7689,17 @@ var serviceContext = (function () {
'', '',
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') { if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] updateWebview`, webviewStyle); console.log(`[uni-app] updateWebview`, webviewStyle);
} }
...@@ -7881,7 +7892,8 @@ var serviceContext = (function () { ...@@ -7881,7 +7892,8 @@ var serviceContext = (function () {
/** /**
* 首页需要主动registerPage,二级页面路由跳转时registerPage * 首页需要主动registerPage,二级页面路由跳转时registerPage
*/ */
function registerPage ({ function registerPage ({
url,
path, path,
query, query,
openType, openType,
...@@ -7920,7 +7932,7 @@ var serviceContext = (function () { ...@@ -7920,7 +7932,7 @@ var serviceContext = (function () {
console.log(`[uni-app] registerPage`, path, webview.id); console.log(`[uni-app] registerPage`, path, webview.id);
} }
initWebview(webview, routeOptions); initWebview(webview, routeOptions, url);
const route = path.slice(1); const route = path.slice(1);
...@@ -7986,6 +7998,7 @@ var serviceContext = (function () { ...@@ -7986,6 +7998,7 @@ var serviceContext = (function () {
} }
function _navigateTo ({ function _navigateTo ({
url,
path, path,
query, query,
animationType, animationType,
...@@ -7998,6 +8011,7 @@ var serviceContext = (function () { ...@@ -7998,6 +8011,7 @@ var serviceContext = (function () {
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'navigate' openType: 'navigate'
...@@ -8020,18 +8034,19 @@ var serviceContext = (function () { ...@@ -8020,18 +8034,19 @@ var serviceContext = (function () {
animationDuration animationDuration
}, callbackId) { }, callbackId) {
const urls = url.split('?'); const urls = url.split('?');
const path = urls[0]; const path = urls[0];
const routeStyles = __uniRoutes.find(route => route.path === path).window; const routeStyles = __uniRoutes.find(route => route.path === path).window;
const globalStyle = __uniConfig.window; const globalStyle = __uniConfig.window;
if (!animationType) { if (!animationType) {
animationType = routeStyles.animationType || globalStyle.animationType || ANI_SHOW; animationType = routeStyles.animationType || globalStyle.animationType || ANI_SHOW;
} }
if (!animationDuration) { if (!animationDuration) {
animationDuration = routeStyles.animationDuration || globalStyle.animationDuration || ANI_DURATION; animationDuration = routeStyles.animationDuration || globalStyle.animationDuration || ANI_DURATION;
} }
const query = parseQuery(urls[1] || ''); const query = parseQuery(urls[1] || '');
navigate(path, function () { navigate(path, function () {
_navigateTo({ _navigateTo({
url,
path, path,
query, query,
animationType, animationType,
...@@ -8041,6 +8056,7 @@ var serviceContext = (function () { ...@@ -8041,6 +8056,7 @@ var serviceContext = (function () {
} }
function _reLaunch ({ function _reLaunch ({
url,
path, path,
query query
}, callbackId) { }, callbackId) {
...@@ -8054,6 +8070,7 @@ var serviceContext = (function () { ...@@ -8054,6 +8070,7 @@ var serviceContext = (function () {
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'reLaunch' openType: 'reLaunch'
...@@ -8082,6 +8099,7 @@ var serviceContext = (function () { ...@@ -8082,6 +8099,7 @@ var serviceContext = (function () {
const query = parseQuery(urls[1] || ''); const query = parseQuery(urls[1] || '');
navigate(path, function () { navigate(path, function () {
_reLaunch({ _reLaunch({
url,
path, path,
query query
}, callbackId); }, callbackId);
...@@ -8089,6 +8107,7 @@ var serviceContext = (function () { ...@@ -8089,6 +8107,7 @@ var serviceContext = (function () {
} }
function _redirectTo ({ function _redirectTo ({
url,
path, path,
query query
}, callbackId) { }, callbackId) {
...@@ -8099,6 +8118,7 @@ var serviceContext = (function () { ...@@ -8099,6 +8118,7 @@ var serviceContext = (function () {
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'redirect' openType: 'redirect'
...@@ -8123,6 +8143,7 @@ var serviceContext = (function () { ...@@ -8123,6 +8143,7 @@ var serviceContext = (function () {
const query = parseQuery(urls[1] || ''); const query = parseQuery(urls[1] || '');
navigate(path, function () { navigate(path, function () {
_redirectTo({ _redirectTo({
url,
path, path,
query query
}, callbackId); }, callbackId);
...@@ -8130,6 +8151,7 @@ var serviceContext = (function () { ...@@ -8130,6 +8151,7 @@ var serviceContext = (function () {
} }
function _switchTab ({ function _switchTab ({
url,
path, path,
from from
}, callbackId) { }, callbackId) {
...@@ -8180,6 +8202,7 @@ var serviceContext = (function () { ...@@ -8180,6 +8202,7 @@ var serviceContext = (function () {
tabBarPage.$getAppWebview().show('none'); tabBarPage.$getAppWebview().show('none');
} else { } else {
return showWebview(registerPage({ return showWebview(registerPage({
url,
path, path,
query: {}, query: {},
openType: 'switchTab' openType: 'switchTab'
...@@ -8205,6 +8228,7 @@ var serviceContext = (function () { ...@@ -8205,6 +8228,7 @@ var serviceContext = (function () {
const path = url.split('?')[0]; const path = url.split('?')[0];
navigate(path, function () { navigate(path, function () {
_switchTab({ _switchTab({
url,
path, path,
from from
}, callbackId); }, callbackId);
...@@ -9451,10 +9475,12 @@ var serviceContext = (function () { ...@@ -9451,10 +9475,12 @@ var serviceContext = (function () {
]; ];
var tempCanvas; var tempCanvas;
function getTempCanvas () { function getTempCanvas (width = 0, height = 0) {
if (!tempCanvas) { if (!tempCanvas) {
tempCanvas = document.createElement('canvas'); tempCanvas = document.createElement('canvas');
} }
tempCanvas.width = width;
tempCanvas.height = height;
return tempCanvas return tempCanvas
} }
...@@ -11771,7 +11797,7 @@ var serviceContext = (function () { ...@@ -11771,7 +11797,7 @@ var serviceContext = (function () {
const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo'; const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo';
process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`); process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`);
return uni[navigateType]({ return uni[navigateType]({
url: entryPagePath, url: entryPagePath + (__uniConfig.entryPageQuery || ''),
openType: 'appLaunch' openType: 'appLaunch'
}) })
} }
...@@ -12003,28 +12029,39 @@ var serviceContext = (function () { ...@@ -12003,28 +12029,39 @@ var serviceContext = (function () {
}); });
} }
function initHotReload () { function initEntryPage () {
const reloadUrl = weex.config.reloadUrl; const argsJsonStr = plus.runtime.arguments;
if (!reloadUrl) { if (!argsJsonStr) {
return return
} }
if (reloadUrl === __uniConfig.entryPagePath) {
let entryPagePath;
let entryPageQuery;
try {
const args = JSON.parse(argsJsonStr);
entryPagePath = args.path || args.pathName;
entryPageQuery = (args.query ? ('?' + args.query) : '');
} catch (e) {}
if (!entryPagePath || entryPagePath === __uniConfig.entryPagePath) {
return return
} }
const reloadPath = '/' + reloadUrl;
const routeOptions = __uniRoutes.find(route => route.path === reloadPath); const entryRoute = '/' + entryPagePath;
const routeOptions = __uniRoutes.find(route => route.path === entryRoute);
if (!routeOptions) { if (!routeOptions) {
return return
} }
if (routeOptions.meta.isNVue) { // 暂不处理 nvue
return
}
if (!routeOptions.meta.isTabBar) { if (!routeOptions.meta.isTabBar) {
__uniConfig.realEntryPagePath = __uniConfig.realEntryPagePath || __uniConfig.entryPagePath; __uniConfig.realEntryPagePath = __uniConfig.realEntryPagePath || __uniConfig.entryPagePath;
} }
__uniConfig.entryPagePath = reloadUrl;
__uniConfig.entryPagePath = entryPagePath;
__uniConfig.entryPageQuery = entryPageQuery;
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] reloadUrl(${reloadUrl})`); console.log(`[uni-app] entryPagePath(${entryPagePath + entryPageQuery})`);
} }
} }
...@@ -12046,7 +12083,7 @@ var serviceContext = (function () { ...@@ -12046,7 +12083,7 @@ var serviceContext = (function () {
getCurrentPages: getCurrentPages$1 getCurrentPages: getCurrentPages$1
}); });
initHotReload(); initEntryPage();
initTabBar(); initTabBar();
......
...@@ -39,7 +39,7 @@ module.exports = function migrate(input, out, options = {}) { ...@@ -39,7 +39,7 @@ module.exports = function migrate(input, out, options = {}) {
) )
) { ) {
options.silent !== true && console.log(`copy: ${dest}`) options.silent !== true && console.log(`copy: ${dest}`)
fs.copySync(src, dest) src !== dest && fs.copySync(src, dest)
} }
} else { } else {
options.silent !== true && console.log(`write: ${path.resolve(out, asset.path)}`) options.silent !== true && console.log(`write: ${path.resolve(out, asset.path)}`)
......
...@@ -89,13 +89,6 @@ const v3 = { ...@@ -89,13 +89,6 @@ const v3 = {
loader: path.resolve(__dirname, loader: path.resolve(__dirname,
'../../packages/webpack-uni-app-loader/view/script') '../../packages/webpack-uni-app-loader/view/script')
}) })
// view 层 renderjs
// rules.push({
// resourceQuery: [/lang=renderjs/, /blockType=renderjs/],
// use: [{
// loader: path.resolve(__dirname, '../../packages/webpack-uni-app-loader/view/renderjs')
// }]
// })
} }
scriptLoaders.push({ scriptLoaders.push({
loader: path.resolve(__dirname, loader: path.resolve(__dirname,
......
...@@ -28,6 +28,7 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api) ...@@ -28,6 +28,7 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
.use('vue-loader') .use('vue-loader')
.loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vue-loader')) .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vue-loader'))
.tap(options => Object.assign(options, { .tap(options => Object.assign(options, {
isH5: process.env.UNI_PLATFORM === 'h5',
compiler: getPlatformCompiler(), compiler: getPlatformCompiler(),
compilerOptions: Object.assign({ compilerOptions: Object.assign({
isUnaryTag, isUnaryTag,
...@@ -35,11 +36,11 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api) ...@@ -35,11 +36,11 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
}, compilerOptions) }, compilerOptions)
}, cacheConfig)) }, cacheConfig))
.end() .end()
// .use('uniapp-custom-block-loader') // .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader')) // .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({ // .options({
// compiler: getPlatformCompiler() // compiler: getPlatformCompiler()
// }) // })
// h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式 // h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式
if (process.env.UNI_PLATFORM === 'h5') { if (process.env.UNI_PLATFORM === 'h5') {
......
const { const {
getPlatformFilterTag, getPlatformFilterTag,
normalizeNodeModules normalizeNodeModules,
jsPreprocessOptions
} = require('@dcloudio/uni-cli-shared/lib/platform') } = require('@dcloudio/uni-cli-shared/lib/platform')
const preprocessor = require('@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/preprocess')
const FILTER_TAG = getPlatformFilterTag() 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) { module.exports = function parseCustomBlocks(descriptor, options) {
if (!descriptor.template || !FILTER_TAG || options.isAppNVue) { if (!descriptor.template || !FILTER_TAG || options.isAppNVue) {
...@@ -23,7 +35,7 @@ module.exports = function parseCustomBlocks(descriptor, options) { ...@@ -23,7 +35,7 @@ module.exports = function parseCustomBlocks(descriptor, options) {
block.attrs.lang === FILTER_TAG block.attrs.lang === FILTER_TAG
) )
) { ) {
modules[block.attrs.module] = block modules[block.attrs.module] = preprocessBlock(block)
return true return true
} }
if ( // renderjs if ( // renderjs
...@@ -33,7 +45,7 @@ module.exports = function parseCustomBlocks(descriptor, options) { ...@@ -33,7 +45,7 @@ module.exports = function parseCustomBlocks(descriptor, options) {
block.attrs.lang === 'renderjs' block.attrs.lang === 'renderjs'
) )
) { ) {
descriptor.renderjs = block descriptor.renderjs = preprocessBlock(block)
modules[block.attrs.module] = Object.assign({}, block, { modules[block.attrs.module] = Object.assign({}, block, {
content: '' content: ''
}) })
......
...@@ -142,7 +142,7 @@ module.exports = function (source) { ...@@ -142,7 +142,7 @@ module.exports = function (source) {
} }
let renderjsImport = `var renderjs` let renderjsImport = `var renderjs`
if(options.isAppView && descriptor.renderjs){ if((options.isAppView || options.isH5) && descriptor.renderjs){
const src = descriptor.renderjs.src || resourcePath const src = descriptor.renderjs.src || resourcePath
const attrsQuery = attrsToQuery(descriptor.renderjs.attrs, 'js') const attrsQuery = attrsToQuery(descriptor.renderjs.attrs, 'js')
const query = `?vue&type=renderjs${attrsQuery}${inheritQuery}` const query = `?vue&type=renderjs${attrsQuery}${inheritQuery}`
......
...@@ -33,8 +33,10 @@ function parseEntryPagePath (appJson, manifestJson) { ...@@ -33,8 +33,10 @@ function parseEntryPagePath (appJson, manifestJson) {
try { try {
const args = JSON.parse(argsJsonStr) const args = JSON.parse(argsJsonStr)
const pathName = args.path || args.pathName const pathName = args.path || args.pathName
const entryPageQuery = (args.query ? ('?' + args.query) : '')
if (pathName && appJson.pages[0] !== pathName) { if (pathName && appJson.pages[0] !== pathName) {
appJson.entryPagePath = pathName appJson.entryPagePath = pathName
appJson.entryPageQuery = entryPageQuery
if (!isTabBarPage(pathName, getTabBarPages(appJson))) { if (!isTabBarPage(pathName, getTabBarPages(appJson))) {
appJson.realEntryPagePath = appJson.pages[0] appJson.realEntryPagePath = appJson.pages[0]
} }
...@@ -83,7 +85,7 @@ module.exports = function (appJson, manifestJson, { ...@@ -83,7 +85,7 @@ module.exports = function (appJson, manifestJson, {
if (appJson.page[appJson.entryPagePath].nvue) { // 首页是 nvue if (appJson.page[appJson.entryPagePath].nvue) { // 首页是 nvue
manifestJson.launch_path = '' // 首页地址为空 manifestJson.launch_path = '' // 首页地址为空
manifestJson.plus.launchwebview.uniNView = { manifestJson.plus.launchwebview.uniNView = {
path: appJson.entryPagePath path: appJson.entryPagePath + '.js' + (appJson.entryPageQuery || '')
} }
if (manifestJson.plus.tabBar) { if (manifestJson.plus.tabBar) {
manifestJson.plus.tabBar.child = ['lauchwebview'] manifestJson.plus.tabBar.child = ['lauchwebview']
...@@ -100,4 +102,4 @@ module.exports = function (appJson, manifestJson, { ...@@ -100,4 +102,4 @@ module.exports = function (appJson, manifestJson, {
manifest.content = JSON.stringify(manifest.content) manifest.content = JSON.stringify(manifest.content)
delete appJson.nvue delete appJson.nvue
return [manifest, definePages(appJson), appConfigService(appJson)] return [manifest, definePages(appJson), appConfigService(appJson)]
} }
import { import {
parseQuery parseQuery
} from 'uni-shared' } from 'uni-shared'
import { import {
ANI_SHOW, ANI_SHOW,
ANI_DURATION ANI_DURATION
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
} from '../../framework/navigator' } from '../../framework/navigator'
function _navigateTo ({ function _navigateTo ({
url,
path, path,
query, query,
animationType, animationType,
...@@ -37,6 +38,7 @@ function _navigateTo ({ ...@@ -37,6 +38,7 @@ function _navigateTo ({
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'navigate' openType: 'navigate'
...@@ -59,22 +61,23 @@ export function navigateTo ({ ...@@ -59,22 +61,23 @@ export function navigateTo ({
animationDuration animationDuration
}, callbackId) { }, callbackId) {
const urls = url.split('?') const urls = url.split('?')
const path = urls[0] const path = urls[0]
const routeStyles = __uniRoutes.find(route => route.path === path).window const routeStyles = __uniRoutes.find(route => route.path === path).window
const globalStyle = __uniConfig.window const globalStyle = __uniConfig.window
if (!animationType) { if (!animationType) {
animationType = routeStyles.animationType || globalStyle.animationType || ANI_SHOW animationType = routeStyles.animationType || globalStyle.animationType || ANI_SHOW
} }
if (!animationDuration) { if (!animationDuration) {
animationDuration = routeStyles.animationDuration || globalStyle.animationDuration || ANI_DURATION animationDuration = routeStyles.animationDuration || globalStyle.animationDuration || ANI_DURATION
} }
const query = parseQuery(urls[1] || '') const query = parseQuery(urls[1] || '')
navigate(path, function () { navigate(path, function () {
_navigateTo({ _navigateTo({
url,
path, path,
query, query,
animationType, animationType,
animationDuration animationDuration
}, callbackId) }, callbackId)
}, openType === 'appLaunch') }, openType === 'appLaunch')
} }
...@@ -22,6 +22,7 @@ import { ...@@ -22,6 +22,7 @@ import {
} from '../../framework/navigator' } from '../../framework/navigator'
function _reLaunch ({ function _reLaunch ({
url,
path, path,
query query
}, callbackId) { }, callbackId) {
...@@ -35,6 +36,7 @@ function _reLaunch ({ ...@@ -35,6 +36,7 @@ function _reLaunch ({
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'reLaunch' openType: 'reLaunch'
...@@ -63,6 +65,7 @@ export function reLaunch ({ ...@@ -63,6 +65,7 @@ export function reLaunch ({
const query = parseQuery(urls[1] || '') const query = parseQuery(urls[1] || '')
navigate(path, function () { navigate(path, function () {
_reLaunch({ _reLaunch({
url,
path, path,
query query
}, callbackId) }, callbackId)
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
} from '../../framework/navigator' } from '../../framework/navigator'
function _redirectTo ({ function _redirectTo ({
url,
path, path,
query query
}, callbackId) { }, callbackId) {
...@@ -30,6 +31,7 @@ function _redirectTo ({ ...@@ -30,6 +31,7 @@ function _redirectTo ({
showWebview( showWebview(
registerPage({ registerPage({
url,
path, path,
query, query,
openType: 'redirect' openType: 'redirect'
...@@ -54,6 +56,7 @@ export function redirectTo ({ ...@@ -54,6 +56,7 @@ export function redirectTo ({
const query = parseQuery(urls[1] || '') const query = parseQuery(urls[1] || '')
navigate(path, function () { navigate(path, function () {
_redirectTo({ _redirectTo({
url,
path, path,
query query
}, callbackId) }, callbackId)
......
...@@ -23,6 +23,7 @@ import { ...@@ -23,6 +23,7 @@ import {
import tabBar from '../../framework/tab-bar' import tabBar from '../../framework/tab-bar'
function _switchTab ({ function _switchTab ({
url,
path, path,
from from
}, callbackId) { }, callbackId) {
...@@ -73,6 +74,7 @@ function _switchTab ({ ...@@ -73,6 +74,7 @@ function _switchTab ({
tabBarPage.$getAppWebview().show('none') tabBarPage.$getAppWebview().show('none')
} else { } else {
return showWebview(registerPage({ return showWebview(registerPage({
url,
path, path,
query: {}, query: {},
openType: 'switchTab' openType: 'switchTab'
...@@ -98,8 +100,9 @@ export function switchTab ({ ...@@ -98,8 +100,9 @@ export function switchTab ({
const path = url.split('?')[0] const path = url.split('?')[0]
navigate(path, function () { navigate(path, function () {
_switchTab({ _switchTab({
url,
path, path,
from from
}, callbackId) }, callbackId)
}, openType === 'appLaunch') }, openType === 'appLaunch')
} }
...@@ -140,28 +140,39 @@ function initTabBar () { ...@@ -140,28 +140,39 @@ function initTabBar () {
}) })
} }
function initHotReload () { function initEntryPage () {
const reloadUrl = weex.config.reloadUrl const argsJsonStr = plus.runtime.arguments
if (!reloadUrl) { if (!argsJsonStr) {
return return
} }
if (reloadUrl === __uniConfig.entryPagePath) {
let entryPagePath
let entryPageQuery
try {
const args = JSON.parse(argsJsonStr)
entryPagePath = args.path || args.pathName
entryPageQuery = (args.query ? ('?' + args.query) : '')
} catch (e) {}
if (!entryPagePath || entryPagePath === __uniConfig.entryPagePath) {
return return
} }
const reloadPath = '/' + reloadUrl
const routeOptions = __uniRoutes.find(route => route.path === reloadPath) const entryRoute = '/' + entryPagePath
const routeOptions = __uniRoutes.find(route => route.path === entryRoute)
if (!routeOptions) { if (!routeOptions) {
return return
} }
if (routeOptions.meta.isNVue) { // 暂不处理 nvue
return
}
if (!routeOptions.meta.isTabBar) { if (!routeOptions.meta.isTabBar) {
__uniConfig.realEntryPagePath = __uniConfig.realEntryPagePath || __uniConfig.entryPagePath __uniConfig.realEntryPagePath = __uniConfig.realEntryPagePath || __uniConfig.entryPagePath
} }
__uniConfig.entryPagePath = reloadUrl
__uniConfig.entryPagePath = entryPagePath
__uniConfig.entryPageQuery = entryPageQuery
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] reloadUrl(${reloadUrl})`) console.log(`[uni-app] entryPagePath(${entryPagePath + entryPageQuery})`)
} }
} }
...@@ -183,7 +194,7 @@ export function registerApp (appVm) { ...@@ -183,7 +194,7 @@ export function registerApp (appVm) {
getCurrentPages getCurrentPages
}) })
initHotReload() initEntryPage()
initTabBar() initTabBar()
......
...@@ -24,7 +24,8 @@ export function getCurrentPages (returnAll) { ...@@ -24,7 +24,8 @@ export function getCurrentPages (returnAll) {
/** /**
* 首页需要主动registerPage,二级页面路由跳转时registerPage * 首页需要主动registerPage,二级页面路由跳转时registerPage
*/ */
export function registerPage ({ export function registerPage ({
url,
path, path,
query, query,
openType, openType,
...@@ -63,7 +64,7 @@ export function registerPage ({ ...@@ -63,7 +64,7 @@ export function registerPage ({
console.log(`[uni-app] registerPage`, path, webview.id) console.log(`[uni-app] registerPage`, path, webview.id)
} }
initWebview(webview, routeOptions) initWebview(webview, routeOptions, url)
const route = path.slice(1) const route = path.slice(1)
......
...@@ -38,7 +38,7 @@ export default function onWebviewReady (data, pageId) { ...@@ -38,7 +38,7 @@ export default function onWebviewReady (data, pageId) {
const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo' const navigateType = routeOptions.meta.isTabBar ? 'switchTab' : 'navigateTo'
process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`) process.env.NODE_ENV !== 'production' && perf(`${entryPagePath} navigateTo`)
return uni[navigateType]({ return uni[navigateType]({
url: entryPagePath, url: entryPagePath + (__uniConfig.entryPageQuery || ''),
openType: 'appLaunch' openType: 'appLaunch'
}) })
} }
......
...@@ -63,7 +63,7 @@ export function createWebview (path, routeOptions) { ...@@ -63,7 +63,7 @@ export function createWebview (path, routeOptions) {
return webview return webview
} }
export function initWebview (webview, routeOptions) { export function initWebview (webview, routeOptions, url = '') {
// 首页或非 nvue 页面 // 首页或非 nvue 页面
if (webview.id === '1' || !routeOptions.meta.isNVue) { if (webview.id === '1' || !routeOptions.meta.isNVue) {
const webviewStyle = parseWebviewStyle( const webviewStyle = parseWebviewStyle(
...@@ -71,6 +71,17 @@ export function initWebview (webview, routeOptions) { ...@@ -71,6 +71,17 @@ export function initWebview (webview, routeOptions) {
'', '',
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') { if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] updateWebview`, webviewStyle) console.log(`[uni-app] updateWebview`, webviewStyle)
} }
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
class="uni-video-control-button" class="uni-video-control-button"
@click.stop="trigger" @click.stop="trigger"
/> />
<div class="uni-video-current-time">{{ currentTime|getTime }}</div> <div class="uni-video-current-time">{{ currentTime|time }}</div>
<div <div
ref="progress" ref="progress"
class="uni-video-progress-container" class="uni-video-progress-container"
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="uni-video-duration">{{ (duration||durationTime)|getTime }}</div> <div class="uni-video-duration">{{ (duration||durationTime)|time }}</div>
</div> </div>
<div <div
v-if="danmuBtn" v-if="danmuBtn"
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<div <div
class="uni-video-cover-play-button" class="uni-video-cover-play-button"
@click.stop="play" /> @click.stop="play" />
<p class="uni-video-cover-duration">{{ (duration||durationTime)|getTime }}</p> <p class="uni-video-cover-duration">{{ (duration||durationTime)|time }}</p>
</div> </div>
<div <div
:class="{'uni-video-toast-volume':gestureType==='volume'}" :class="{'uni-video-toast-volume':gestureType==='volume'}"
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
<div <div
:class="{'uni-video-toast-progress':gestureType=='progress'}" :class="{'uni-video-toast-progress':gestureType=='progress'}"
class="uni-video-toast"> class="uni-video-toast">
<div class="uni-video-toast-title">{{ currentTimeNew|getTime }} / {{ durationTime|getTime }}</div> <div class="uni-video-toast-title">{{ currentTimeNew|time }} / {{ durationTime|time }}</div>
</div> </div>
</div> </div>
<div <div
...@@ -162,10 +162,11 @@ const GestureType = { ...@@ -162,10 +162,11 @@ const GestureType = {
export default { export default {
name: 'Video', name: 'Video',
filters: { filters: {
getTime (time) { time (val) {
let h = Math.floor(time / 3600) val = val > 0 && val < Infinity ? val : 0
let m = Math.floor(time % 3600 / 60) let h = Math.floor(val / 3600)
let s = Math.floor(time % 3600 % 60) let m = Math.floor(val % 3600 / 60)
let s = Math.floor(val % 3600 % 60)
h = (h < 10 ? '0' : '') + h h = (h < 10 ? '0' : '') + h
m = (m < 10 ? '0' : '') + m m = (m < 10 ? '0' : '') + m
s = (s < 10 ? '0' : '') + s s = (s < 10 ? '0' : '') + s
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册