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

调整部分代码,方便支持optimize

上级 9063ea96
......@@ -28,7 +28,8 @@ module.exports = {
'uni-shared': resolve('src/shared'),
'uni-mixins': resolve('src/core/view/mixins'),
'uni-helpers': resolve('src/core/helpers'),
'uni-platform': resolve('src/platforms/' + process.env.UNI_PLATFORM)
'uni-platform': resolve('src/platforms/' + process.env.UNI_PLATFORM),
'uni-components': resolve('src/core/view/components')
}
},
module: {
......
......@@ -40,6 +40,7 @@ config.plugins = config.plugins.concat([
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM)
}),
new webpack.ProvidePlugin({
'console': [resolve('src/core/helpers/console'), 'default'],
'UniViewJSBridge': [resolve('src/core/view/bridge')],
'UniServiceJSBridge': [resolve('src/core/service/bridge')]
})
......
......@@ -34,4 +34,6 @@ Vue.use(require('uni-view/plugins').default, {
routes: __uniRoutes
})
require('uni-view/components')
require('uni-core/vue')
require('uni-platform/components')
require('uni-components')
此差异已折叠。
因为 它太大了无法显示 source diff 。你可以改为 查看blob
import Vue from 'vue'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import tags from 'uni-helpers/tags'
import baseMixin from 'uni-mixins/base'
// const uniRegex = /^uni-/i
// const htmlRegex = /^html:/i
// const svgRegex = /^svg:/i
const oldIsReservedTag = Vue.config.isReservedTag
Vue.config.isReservedTag = function (tag) {
return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
}
// Vue.config.parsePlatformTagName = function(tag) {
// return tag.replace(htmlRegex, '').replace(svgRegex, '')
// }
Vue.config.ignoredElements = tags
const oldGetTagNamespace = Vue.config.getTagNamespace
const conflictTags = ['switch', 'image', 'text', 'view']
Vue.config.getTagNamespace = function (tag) {
if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突
return false
}
return oldGetTagNamespace(tag) || false
}
Vue.config.errorHandler = function (err, vm, info) {
console.error('errorHandler', err, vm, info)
}
const requireComponents = [
// frameworkComponents
/* eslint-disable no-undef */
require.context('../../../platforms/' + __PLATFORM__ + '/components', true, /index\.vue$/),
// baseComponents
require.context('./', true, /index\.vue$/),
require.context('../../../platforms/' + __PLATFORM__ + '/view/components', true, /index\.vue$/)
......@@ -54,9 +17,7 @@ requireComponents.forEach((components, index) => {
componentConfig.mixins = componentConfig.mixins ? [].concat(baseMixin, componentConfig.mixins) : [baseMixin]
if (index > 0) {
componentConfig.name = 'VUni' + componentConfig.name
}
// 全局注册组件
Vue.component(componentConfig.name, componentConfig)
......
import Vue from 'vue'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import tags from 'uni-helpers/tags'
const oldIsReservedTag = Vue.config.isReservedTag
Vue.config.isReservedTag = function (tag) {
return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
}
Vue.config.ignoredElements = tags
const oldGetTagNamespace = Vue.config.getTagNamespace
const conflictTags = ['switch', 'image', 'text', 'view']
Vue.config.getTagNamespace = function (tag) {
if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突
return false
}
return oldGetTagNamespace(tag) || false
}
Vue.config.errorHandler = function (err, vm, info) {
console.error('errorHandler', err, vm, info)
}
import Vue from 'vue'
import App from './app'
import Page from './page'
import AsyncError from './async-error'
import AsyncLoading from './async-loading'
import ChooseLocation from './system-routes/choose-location'
import OpenLocation from './system-routes/open-location'
import PreviewImage from './system-routes/preview-image'
Vue.component(App.name, App)
Vue.component(Page.name, Page)
Vue.component(AsyncError.name, AsyncError)
Vue.component(AsyncLoading.name, AsyncLoading)
Vue.component(ChooseLocation.name, ChooseLocation)
Vue.component(OpenLocation.name, OpenLocation)
Vue.component(PreviewImage.name, PreviewImage)
......@@ -10,13 +10,18 @@
allow="geolocation"
seamless
sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0"/>
frameborder="0" />
</div>
</div>
</template>
<script>
import SystemHeader from '../system-header'
export default {
name: 'SystemChooseLocation',
components: {
SystemHeader
},
data () {
return {
src: '',
......@@ -53,7 +58,7 @@ export default {
}
</script>
<style>
.uni-system-choose-location {
.uni-system-choose-location {
display: block;
position: fixed;
left: 0;
......@@ -61,19 +66,19 @@ export default {
width: 100%;
height: 100%;
background: #f8f8f8;
}
}
.map-content {
.map-content {
position: absolute;
left: 0;
top: 44px;
width: 100%;
bottom: 0;
overflow: hidden;
}
}
.map-content > iframe {
.map-content>iframe {
width: 100%;
height: 100%;
}
}
</style>
......@@ -8,22 +8,27 @@
allow="geolocation"
sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0"
@load="_load"/>
@load="_load" />
<!-- 去这里 -->
<div
v-if="isPoimarkerSrc"
class="actTonav"
@click="_nav"/>
@click="_nav" />
</div>
</div>
</template>
<script>
import SystemHeader from '../system-header'
const key = 'WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS'
const referer = 'uniapp'
const poimarkerSrc = 'https://apis.map.qq.com/tools/poimarker'
export default {
name: 'SystemOpenLocation',
components: {
SystemHeader
},
data () {
const {
latitude,
......@@ -44,7 +49,8 @@ export default {
},
mounted () {
if (this.latitude && this.longitude) {
this.src = `${poimarkerSrc}?type=0&marker=coord:${this.latitude},${this.longitude};title:${this.name};addr:${this.address};&key=${key}&referer=${referer}`
this.src =
`${poimarkerSrc}?type=0&marker=coord:${this.latitude},${this.longitude};title:${this.name};addr:${this.address};&key=${key}&referer=${referer}`
}
},
methods: {
......@@ -63,14 +69,15 @@ 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://apis.map.qq.com/uri/v1/routeplan?type=drive&to=${encodeURIComponent(this.name)}&tocoord=${this.latitude},${this.longitude}&referer=${referer}`
this.$refs.map.src = url
}
}
}
</script>
<style>
.uni-system-open-location {
.uni-system-open-location {
display: block;
position: fixed;
left: 0;
......@@ -78,28 +85,29 @@ export default {
width: 100%;
height: 100%;
background: #f8f8f8;
}
}
.map-content {
.map-content {
position: absolute;
left: 0;
top: 44px;
width: 100%;
bottom: 0;
overflow: hidden;
}
}
.map-content > iframe {
.map-content>iframe {
width: 100%;
height: 100%;
border: none;
}
.actTonav {
}
.actTonav {
position: absolute;
right: 16px;
bottom: 56px;
width: 60px;
height: 60px;
border-radius: 60px;
}
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册