融易学混合APP

133 阅读1分钟

gitee地址

兼容性问题

1. safari下overflow:hidden;无效的问题

// 需要注意的是要同时给html指定高度,否则会出现页面被截掉一部分的效果 
{
    position:fixed;
    overflow-y:hidden;
    height:100%;
    width:100%;
}

2. 滚动组件滑动条隐藏的问题

某些版本的safari无法隐藏滑动条

app端切换网页源的思路

通过hash模式reload页面得到用户选择的源

let origin = Node.prototype.appendChild;
document.head.appendChild = function(c){
	// 判断c的src属性,拼接地址
	origin.call(this, c);
}
  1. 先判断路径,是否带有确定源的参数
  2. newsn.net/say/webpack…
  3. github.com/bholloway/r…
  4. vue-cli@4中默认的html-webpack-plugin配置

动态组件的一种实现

www.jianshu.com/p/c894ea00d…

<style lang="scss" scoped>

</style>

<template>
    <div v-is="current"></div>
</template>

<script>
import Vue from 'vue'
const context = require.context('./actives', false, /\.vue$/);

console.dir(context)
console.dir(context.keys())
console.dir(context.resolve)
const components = {};
export default {

    components,

    beforeRouteEnter(to, from, next){
        console.log(context.resolve('./Active1.vue'))
        console.log(context(context.keys()[0]))
        Vue.component('Active1', () => Promise.resolve(context(context.keys()[0])));
        next();
    }

}
</script>