提交 d5ebc498 编写于 作者: Q qiang

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

......@@ -2721,8 +2721,11 @@ var serviceContext = (function () {
return false
}
return page.$page.meta.isTabBar
}
if (!/^\//.test(path)) {
path = '/' + path;
}
const route = __uniRoutes.find(route => route.path.replace(/^\//, '') === path.replace(/^\//, ''));
const route = __uniRoutes.find(route => route.path === path);
return route && route.meta.isTabBar
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
......@@ -2886,7 +2889,25 @@ var serviceContext = (function () {
const outOfChina = function (lng, lat) {
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false)
};
};
function getStatusbarHeight () {
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return plus.navigator.isImmersedStatusbar() ? Math.round(plus.os.name === 'iOS' ? plus.navigator.getSafeAreaInsets().top : plus.navigator.getStatusbarHeight()) : 0
}
function getScreenInfo () {
const orientation = plus.navigator.getOrientation();
const landscape = Math.abs(orientation) === 90;
// 安卓 plus 接口获取的屏幕大小值不为整数
const width = plus.screen.resolutionWidth;
const height = plus.screen.resolutionHeight;
// 根据方向纠正宽高
return {
screenWidth: Math[landscape ? 'max' : 'min'](width, height),
screenHeight: Math[landscape ? 'min' : 'max'](width, height)
}
}
let audios = {};
......@@ -4941,48 +4962,55 @@ var serviceContext = (function () {
function getSystemInfo () {
const platform = plus.os.name.toLowerCase();
const ios = platform === 'ios';
// 安卓 plus 接口获取的屏幕大小值不为整数,iOS js 获取的屏幕大小横屏时颠倒
const screenWidth = plus.screen.resolutionWidth;
const screenHeight = plus.screen.resolutionHeight;
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
var landscape = Math.abs(plus.navigator.getOrientation()) === 90;
var statusBarHeight = Math.round(plus.navigator.getStatusbarHeight());
if (ios && landscape) {
statusBarHeight = Math.min(20, statusBarHeight);
}
var safeAreaInsets;
function getSafeAreaInsets () {
return {
left: 0,
right: 0,
top: titleNView ? 0 : statusBarHeight,
bottom: 0
}
}
// 判断是否存在 titleNView
var titleNView;
var webview = getLastWebview();
const {
screenWidth,
screenHeight
} = getScreenInfo();
const statusBarHeight = getStatusbarHeight();
let safeAreaInsets;
const titleNView = {
height: 0,
cover: false
};
const webview = getLastWebview();
if (webview) {
let style = webview.getStyle();
if (style) {
titleNView = style && style.titleNView;
titleNView = titleNView && titleNView.type === 'default';
style = style && style.titleNView;
if (style && style.type && style.type !== 'none') {
titleNView.height = style.type === 'transparent' ? 0 : (statusBarHeight + TITLEBAR_HEIGHT);
titleNView.cover = style.type === 'transparent' || style.type === 'float';
}
safeAreaInsets = ios ? webview.getSafeAreaInsets() : getSafeAreaInsets();
safeAreaInsets = webview.getSafeAreaInsets();
} else {
safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets();
safeAreaInsets = plus.navigator.getSafeAreaInsets();
}
var windowBottom = isTabBarPage() && tabBar$1.visible && tabBar$1.cover ? tabBar$1.height : 0;
var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT)
: 0) - windowBottom, screenHeight);
var windowWidth = screenWidth;
var safeArea = {
const tabBarView = {
height: 0,
cover: false
};
if (isTabBarPage()) {
tabBarView.height = tabBar$1.visible ? tabBar$1.height : 0;
tabBarView.cover = tabBar$1.cover;
}
const windowTop = titleNView.cover ? titleNView.height : 0;
const windowBottom = tabBarView.cover ? tabBarView.height : 0;
const windowHeight = screenHeight - titleNView.height - tabBarView.height;
const windowHeightReal = screenHeight - (titleNView.cover ? 0 : titleNView.height) - (tabBarView.cover ? 0 : tabBarView.height);
const windowWidth = screenWidth;
safeAreaInsets = ios ? safeAreaInsets : {
left: 0,
right: 0,
top: titleNView.height && !titleNView.cover ? 0 : statusBarHeight,
bottom: 0
};
const safeArea = {
left: safeAreaInsets.left,
right: windowWidth - safeAreaInsets.right,
top: safeAreaInsets.top,
bottom: windowHeight - safeAreaInsets.bottom,
bottom: windowHeightReal - safeAreaInsets.bottom,
width: windowWidth - safeAreaInsets.left - safeAreaInsets.right,
height: windowHeight - safeAreaInsets.top - safeAreaInsets.bottom
height: windowHeightReal - safeAreaInsets.top - safeAreaInsets.bottom
};
return {
......@@ -5001,9 +5029,15 @@ var serviceContext = (function () {
fontSizeSetting: '',
platform,
SDKVersion: '',
windowTop: 0,
windowTop,
windowBottom,
safeArea
safeArea,
safeAreaInsets: {
top: safeAreaInsets.top,
right: safeAreaInsets.right,
bottom: safeAreaInsets.bottom,
left: safeAreaInsets.left
}
}
}
......@@ -7276,7 +7310,7 @@ var serviceContext = (function () {
function parsePullToRefresh (routeOptions) {
const windowOptions = routeOptions.window;
if (windowOptions.enablePullDownRefresh) {
if (windowOptions.enablePullDownRefresh || (windowOptions.pullToRefresh && windowOptions.pullToRefresh.support)) {
const pullToRefreshStyles = Object.create(null);
// 初始化默认值
if (plus.os.name === 'Android') {
......@@ -7498,7 +7532,7 @@ var serviceContext = (function () {
style.dock = 'top';
style.top = 0;
style.width = '100%';
style.height = TITLEBAR_HEIGHT + plus.navigator.getStatusbarHeight();
style.height = TITLEBAR_HEIGHT + getStatusbarHeight();
delete style.left;
delete style.right;
delete style.bottom;
......@@ -7768,7 +7802,10 @@ var serviceContext = (function () {
let todoNavigator = false;
function navigate (path, callback, isAppLaunch) {
{
{
if (isAppLaunch && __uniConfig.splashscreen && __uniConfig.splashscreen.autoclose && (!__uniConfig.splashscreen.alwaysShowBeforeRender)) {
plus.navigator.closeSplashscreen();
}
if (!isAppLaunch && todoNavigator) {
return console.error(`已存在待跳转页面${todoNavigator.path},请不要连续多次跳转页面${path}`)
}
......@@ -12073,8 +12110,9 @@ var serviceContext = (function () {
if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] registerApp`);
}
appCtx = appVm;
appCtx = appVm;
appCtx.$vm = appVm;
Object.assign(appCtx, defaultApp); // 拷贝默认实现
......@@ -12278,7 +12316,7 @@ var serviceContext = (function () {
const isAndroid = plus.os.name.toLowerCase() === 'android';
const FOCUS_TIMEOUT = isAndroid ? 300 : 700;
const HIDE_TIMEOUT = 300;
const HIDE_TIMEOUT = 800;
let keyboardHeight = 0;
let onKeyboardShow;
let focusTimer;
......@@ -12915,13 +12953,15 @@ var serviceContext = (function () {
const onPageScroll = hasLifecycleHook(vm.$options, 'onPageScroll') ? 1 : 0;
const onPageReachBottom = hasLifecycleHook(vm.$options, 'onReachBottom') ? 1 : 0;
const statusbarHeight = getStatusbarHeight();
return {
disableScroll,
onPageScroll,
onPageReachBottom,
onReachBottomDistance,
windowTop: 0, // TODO
statusbarHeight,
windowTop: windowOptions.titleNView && windowOptions.titleNView.type === 'float' ? (statusbarHeight + TITLEBAR_HEIGHT) : 0,
windowBottom: (tabBar$1.indexOf(route) >= 0 && tabBar$1.cover) ? tabBar$1.height : 0
}
}
......
......@@ -330,17 +330,37 @@ const autoComponentMap = {}
let lastUsingAutoImportComponentsJson = ''
process.UNI_AUTO_COMPONENTS = []
let uniAutoImportComponents = []
let uniAutoImportScanComponents = []
function initAutoImportScanComponents () {
const componentsPath = path.resolve(process.env.UNI_INPUT_DIR, 'components')
const components = {}
try {
fs.readdirSync(componentsPath).forEach(name => {
if (fs.existsSync(path.resolve(componentsPath, name, name + '.vue'))) {
components[`^${name}$`] = `@/components/${name}/${name}.vue`
} else if (fs.existsSync(path.resolve(componentsPath, name, name + '.nvue'))) {
components[`^${name}$`] = `@/components/${name}/${name}.nvue`
}
})
} catch (e) {}
uniAutoImportScanComponents = parseUsingAutoImportComponents(components)
refreshAutoComponentMap()
}
function initAutoImportComponents (usingAutoImportComponents = {}) {
// 目前仅 mp-weixin 内置支持 page-meta 等组件
if (process.env.UNI_PLATFORM !== 'mp-weixin') {
if (!usingAutoImportComponents['page-meta']) {
usingAutoImportComponents['page-meta'] =
if (!usingAutoImportComponents['^page-meta$']) {
usingAutoImportComponents['^page-meta$'] =
'@dcloudio/uni-cli-shared/components/page-meta.vue'
}
if (!usingAutoImportComponents['navigation-bar']) {
usingAutoImportComponents['navigation-bar'] =
if (!usingAutoImportComponents['^navigation-bar$']) {
usingAutoImportComponents['^navigation-bar$'] =
'@dcloudio/uni-cli-shared/components/navigation-bar.vue'
}
}
......@@ -348,7 +368,7 @@ function initAutoImportComponents (usingAutoImportComponents = {}) {
const newUsingAutoImportComponentsJson = JSON.stringify(usingAutoImportComponents)
if (newUsingAutoImportComponentsJson !== lastUsingAutoImportComponentsJson) {
lastUsingAutoImportComponentsJson = newUsingAutoImportComponentsJson
process.UNI_AUTO_COMPONENTS = parseUsingAutoImportComponents(usingAutoImportComponents)
uniAutoImportComponents = parseUsingAutoImportComponents(usingAutoImportComponents)
refreshAutoComponentMap()
}
}
......@@ -363,8 +383,10 @@ function refreshAutoComponentMap () {
}
function addAutoComponent (name) {
const options = process.UNI_AUTO_COMPONENTS
const opt = options.find(opt => opt.pattern.test(name))
let opt = uniAutoImportComponents.find(opt => opt.pattern.test(name))
if (!opt) {
opt = uniAutoImportScanComponents.find(opt => opt.pattern.test(name))
}
if (!opt) { // 不匹配
return (autoComponentMap[name] = true) // cache
}
......@@ -410,7 +432,8 @@ module.exports = {
parsePagesJson,
pagesJsonJsFileName,
getAutoComponents,
initAutoImportComponents,
initAutoImportComponents,
initAutoImportScanComponents,
addPageUsingComponents,
getUsingComponentsCode,
generateUsingComponentsCode,
......
......@@ -80,11 +80,10 @@ module.exports = (api, options) => {
webpackConfig.module
.rule('vue')
.use('vue-loader')
.loader(resolve('packages/vue-loader'))
.tap(options => Object.assign(options, {
isH5TreeShaking: true,
cacheDirectory: false,
cacheIdentifier: false,
compilerOptions: require('@dcloudio/vue-cli-plugin-uni/lib/h5/compiler-options')
cacheIdentifier: false
}))
.end()
.uses
......
const path = require('path')
const hash = require('hash-sum')
const qs = require('querystring')
const plugin = require('vue-loader/lib/plugin')
const selectBlock = require('vue-loader/lib/select')
const loaderUtils = require('loader-utils')
const { attrsToQuery } = require('vue-loader/lib/codegen/utils')
const { parse } = require('@vue/component-compiler-utils')
const genStylesCode = require('vue-loader/lib/codegen/styleInjection')
const { genHotReloadCode } = require('vue-loader/lib/codegen/hotReload')
const genCustomBlocksCode = require('vue-loader/lib/codegen/customBlocks')
const componentNormalizerPath = require.resolve('vue-loader/lib/runtime/componentNormalizer')
const { NS } = require('vue-loader/lib/plugin')
const { src } = require('@dcloudio/uni-h5/path')
let errorEmitted = false
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
function loadTemplateCompiler (loaderContext) {
try {
return require('vue-template-compiler')
} catch (e) {
if (/version mismatch/.test(e.toString())) {
loaderContext.emitError(e)
} else {
loaderContext.emitError(new Error(
`[vue-loader] vue-template-compiler must be installed as a peer dependency, ` +
`or a compatible compiler implementation must be passed via options.`
))
}
}
}
let modules
module.exports = function (source) {
const loaderContext = this
if (!errorEmitted && !loaderContext['thread-loader'] && !loaderContext[NS]) {
loaderContext.emitError(new Error(
`vue-loader was used without the corresponding plugin. ` +
`Make sure to include VueLoaderPlugin in your webpack config.`
))
errorEmitted = true
}
const stringifyRequest = r => loaderUtils.stringifyRequest(loaderContext, r)
const {
target,
request,
minimize,
sourceMap,
rootContext,
resourcePath,
resourceQuery
} = loaderContext
const rawQuery = resourceQuery.slice(1)
const inheritQuery = `&${rawQuery}`
const incomingQuery = qs.parse(rawQuery)
const options = loaderUtils.getOptions(loaderContext) || {}
const isServer = target === 'node'
const isShadow = !!options.shadowMode
const isProduction = options.productionMode || minimize || process.env.NODE_ENV === 'production'
const filename = path.basename(resourcePath)
const context = rootContext || process.cwd()
const sourceRoot = path.dirname(path.relative(context, resourcePath))
const descriptor = parse({
source,
compiler: options.compiler || loadTemplateCompiler(loaderContext),
filename,
sourceRoot,
needMap: sourceMap
})
// fixed by xxxxxx
if(!modules && options.compilerOptions && options.compilerOptions.modules){
modules = options.compilerOptions.modules
}
const sourcePath = normalizePath(src)
if (normalizePath(this.resourcePath).indexOf(sourcePath) === 0) {
descriptor.styles.length = 0
options.compilerOptions && (delete options.compilerOptions.modules)
} else if(options.compilerOptions){
options.compilerOptions.modules = modules
}
// if the query has a type field, this is a language block request
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
if (incomingQuery.type) {
return selectBlock(
descriptor,
loaderContext,
incomingQuery,
!!options.appendExtension
)
}
// module id for scoped CSS & hot-reload
const rawShortFilePath = path
.relative(context, resourcePath)
.replace(/^(\.\.[\/\\])+/, '')
const shortFilePath = rawShortFilePath.replace(/\\/g, '/') + resourceQuery
const id = hash(
isProduction
? (shortFilePath + '\n' + source)
: shortFilePath
)
// feature information
const hasScoped = descriptor.styles.some(s => s.scoped)
const hasFunctional = descriptor.template && descriptor.template.attrs.functional
const needsHotReload = (
!isServer &&
!isProduction &&
(descriptor.script || descriptor.template) &&
options.hotReload !== false
)
// template
let templateImport = `var render, staticRenderFns`
let templateRequest
if (descriptor.template) {
const src = descriptor.template.src || resourcePath
const idQuery = `&id=${id}`
const scopedQuery = hasScoped ? `&scoped=true` : ``
const attrsQuery = attrsToQuery(descriptor.template.attrs)
const query = `?vue&type=template${idQuery}${scopedQuery}${attrsQuery}${inheritQuery}`
const request = templateRequest = stringifyRequest(src + query)
templateImport = `import { render, staticRenderFns } from ${request}`
}
// script
let scriptImport = `var script = {}`
if (descriptor.script) {
const src = descriptor.script.src || resourcePath
const attrsQuery = attrsToQuery(descriptor.script.attrs, 'js')
const query = `?vue&type=script${attrsQuery}${inheritQuery}`
const request = stringifyRequest(src + query)
scriptImport = (
`import script from ${request}\n` +
`export * from ${request}` // support named exports
)
}
// styles
let stylesCode = ``
if (descriptor.styles.length) {
stylesCode = genStylesCode(
loaderContext,
descriptor.styles,
id,
resourcePath,
stringifyRequest,
needsHotReload,
isServer || isShadow // needs explicit injection?
)
}
let code = `
${templateImport}
${scriptImport}
${stylesCode}
/* normalize component */
import normalizer from ${stringifyRequest(`!${componentNormalizerPath}`)}
var component = normalizer(
script,
render,
staticRenderFns,
${hasFunctional ? `true` : `false`},
${/injectStyles/.test(stylesCode) ? `injectStyles` : `null`},
${hasScoped ? JSON.stringify(id) : `null`},
${isServer ? JSON.stringify(hash(request)) : `null`}
${isShadow ? `,true` : ``}
)
`.trim() + `\n`
if (descriptor.customBlocks && descriptor.customBlocks.length) {
code += genCustomBlocksCode(
descriptor.customBlocks,
resourcePath,
resourceQuery,
stringifyRequest
)
}
if (needsHotReload) {
code += `\n` + genHotReloadCode(id, hasFunctional, templateRequest)
}
// Expose filename. This is used by the devtools and Vue runtime warnings.
if (!isProduction) {
// Expose the file's full path in development, so that it can be opened
// from the devtools.
code += `\ncomponent.options.__file = ${JSON.stringify(rawShortFilePath.replace(/\\/g, '/'))}`
} else if (options.exposeFilename) {
// Libraies can opt-in to expose their components' filenames in production builds.
// For security reasons, only expose the file's basename in production.
code += `\ncomponent.options.__file = ${JSON.stringify(filename)}`
}
code += `\nexport default component.exports`
// console.log(code)
return code
}
module.exports.VueLoaderPlugin = plugin
......@@ -11,6 +11,8 @@ const {
getGlobalUsingComponentsCode
} = require('@dcloudio/uni-cli-shared/lib/pages')
const WebpackUniAppPlugin = require('../../packages/webpack-uni-app-loader/plugin/index')
const {
isUnaryTag,
getPartialIdentifier
......@@ -36,7 +38,7 @@ function getProvides (isAppService) {
'getRegExp': [wxsPath, 'getRegExp']
}
}
return { // app-view
return { // app-view
'__f__': [path.resolve(__dirname, '../format-log.js'), 'default'],
'getDate': [wxsPath, 'getDate'],
'getRegExp': [wxsPath, 'getRegExp']
......@@ -172,6 +174,7 @@ const v3 = {
]
},
plugins: [
new WebpackUniAppPlugin(),
new webpack.ProvidePlugin(getProvides(isAppService))
]
}
......@@ -246,13 +249,13 @@ const v3 = {
compilerOptions
}, cacheConfig))
.end()
// .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({
// isAppService,
// isAppView,
// compiler: getPlatformCompiler()
// })
// .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({
// isAppService,
// isAppView,
// compiler: getPlatformCompiler()
// })
// 是否启用 cache
if (process.env.UNI_USING_CACHE) {
......
......@@ -312,9 +312,11 @@ if (
}
const {
initAutoImportComponents
initAutoImportComponents,
initAutoImportScanComponents
} = require('@dcloudio/uni-cli-shared/lib/pages')
initAutoImportScanComponents()
initAutoImportComponents(pagesJsonObj.easycom)
runByHBuilderX && console.log(`正在编译中...`)
......
......@@ -15,6 +15,8 @@ const modifyVueLoader = require('../vue-loader')
const WebpackHtmlAppendPlugin = require('../../packages/webpack-html-append-plugin')
const WebpackUniAppPlugin = require('../../packages/webpack-uni-app-loader/plugin/index')
function resolve (dir) {
return path.resolve(__dirname, '../../', dir)
}
......@@ -41,6 +43,7 @@ function getProvides () {
}
const plugins = [
new WebpackUniAppPlugin(),
new webpack.ProvidePlugin(getProvides())
]
......
......@@ -8,6 +8,8 @@ const {
getPlatformCssnano
} = require('@dcloudio/uni-cli-shared')
const WebpackUniAppPlugin = require('../packages/webpack-uni-app-loader/plugin/index')
const modifyVueLoader = require('./vue-loader')
const {
......@@ -157,6 +159,7 @@ module.exports = {
}]
},
plugins: [
new WebpackUniAppPlugin(),
createUniMPPlugin(),
new webpack.ProvidePlugin(getProvides())
]
......
......@@ -6785,6 +6785,8 @@ function updateWxsProps(oldVnode, vnode) {
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6815,6 +6815,8 @@ function updateWxsProps(oldVnode, vnode) {
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6807,6 +6807,8 @@ function updateWxsProps(oldVnode, vnode) {
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6789,6 +6789,8 @@
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6774,6 +6774,8 @@ function updateWxsProps(oldVnode, vnode) {
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6796,6 +6796,8 @@ function updateWxsProps(oldVnode, vnode) {
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -6778,6 +6778,8 @@
context.$getComponentDescriptor(context, true),
vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
);
}, {
deep: true
});
});
......
......@@ -13,7 +13,7 @@ const componentNormalizerPath = require.resolve('./runtime/componentNormalizer')
const { NS } = require('./plugin')
let errorEmitted = false
let modules // h5 平台摇树优化时,需要保留编译器原始modules(因为框架内代码不需要modules,开发者代码需要)
function loadTemplateCompiler (loaderContext) {
try {
return require('vue-template-compiler')
......@@ -75,6 +75,23 @@ module.exports = function (source) {
isAppNVue: options.isAppNVue
})
if (options.isH5TreeShaking) { // 摇树优化逻辑(框架组件移除样式,禁用 modules)
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
// fixed by xxxxxx
if(!modules && options.compilerOptions && options.compilerOptions.modules){
modules = options.compilerOptions.modules
}
const sourcePath = normalizePath(require('@dcloudio/uni-h5/path').src)
if (normalizePath(this.resourcePath).indexOf(sourcePath) === 0) {
descriptor.styles.length = 0
options.compilerOptions && (delete options.compilerOptions.modules)
} else if(options.compilerOptions){
options.compilerOptions.modules = modules
}
}
// if the query has a type field, this is a language block request
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
......
const path = require('path')
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
const {
initAutoImportScanComponents
} = require('@dcloudio/uni-cli-shared/lib/pages')
class WebpackUniAppPlugin {
apply(compiler) {
compiler.hooks.invalid.tap('webpack-uni-app-invalid', (fileName, changeTime) => {
if (fileName && typeof fileName === 'string') {
if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) {
initAutoImportScanComponents()
}
}
})
}
}
module.exports = WebpackUniAppPlugin
......@@ -69,8 +69,8 @@ export default {
}
},
_nav () {
var url =
`https://apis.map.qq.com/uri/v1/routeplan?type=drive&to=${encodeURIComponent(this.name || '目的地')}&tocoord=${this.latitude},${this.longitude}&referer=${referer}`
var url =
`https://map.qq.com/nav/drive#routes/page?transport=2&epointy=${this.latitude}&epointx=${this.longitude}&eword=${encodeURIComponent(this.name || '目的地')}&referer=${referer}`
this.$refs.map.src = url
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册