当前位置: 首页 > news >正文

做线上网站需要多少钱自媒体怎么入门

做线上网站需要多少钱,自媒体怎么入门,在线网络培训平台,网站后台编辑器内容不显示面临问题 : back的后台以jsp嵌套iframe为主, 所以在前端框架要把iframe无刷新嵌套和vue页面进行并行使用,vue的keep-alive只能对虚拟dom树 vtree 进行缓存无法缓存iframe,所以要对iframe进行处理 tab标签的切换效果具体参考若依框架的tab切换,可以去若依看源码,若依源码没有实…

面临问题 : back的后台以jsp嵌套iframe为主, 所以在前端框架要把iframe无刷新嵌套和vue页面进行并行使用,vue的keep-alive只能对虚拟dom树 vtree 进行缓存无法缓存iframe,所以要对iframe进行处理

tab标签的切换效果具体参考若依框架的tab切换,可以去若依看源码,若依源码没有实现这个效果,以下代码基于若依源码进行优化

一开始打算把每个iframe嵌入到router页面里面,但这样会导致几十个iframe页面全部占用内存,用v-show显示,所以要做成点击的才会占有内存

实现效果

  1. 每个iframe页面有单独的路由
  2. 刷新页面可以对当前iframe页面进行刷新
    
  3. vue 页面未缓存和缓存和iframe页面3者进行并行存在,并且达到效果
    
  4. 刷新标签可以对iframe页面进行刷新
    
  5. 点击才会占用内存
    

解决方案 采用iframe和keeplive分开的方案,用v-show进行判断,把每个iframe嵌入到router里的/frame/: 的动态路由里面,用户点击iiframe的菜单就会生成一个 /iframe/brand-list的页面,页面根据逻辑去找到对应iframe去生成tab,并且建立内存资源达到切换tab不刷新的效果 以下为实现效果*
在这里插入图片描述 最终实现效果,5个页面切换 无感刷新,并且iframe动态引入

iframe路由页面
//iframe 路由
const commonPath = import.meta.env.VITE_APP_PATH || 'g-back'getIframeList(){return[{fullPath:`${commonPath}/iframe/brand-list`,path:`${commonPath}/iframe/brand-list`,// name:"brand-list",meta:{title:"品牌维护",link:'baidu.com',}},{fullPath:`${commonPath}/iframe/brand-list`,path:`${commonPath}/iframe/category-goodsType`,// name:"category-goodsType",meta:{title:"品牌分类",link:'baidu.com',}},{fullPath:`${commonPath}/iframe/brand-list`,path:`${commonPath}/iframe/standard-list`,// name:"standard-list",meta:{title:"商品标准",link:'baidu.com',}}]}router.js页面 vue路由
const remainingRouter: AppRouteRecordRaw[] = [{path: `/`,redirect: '/g-back/index',},{path: '/g-back',redirect: '/g-back/index',children: [{path: '/g-back/index',component: () => import('@/views/home/index.vue'),name: 'index',meta: { title: '首页', icon: 'dashboard' }}]},{path: '/404',component: () => import('@/views/404/index.vue'),name: '404',meta: { title: '404', icon: 'dashboard'}},{path: `${commonPath}/iframe/:id`,component: () => import('@/views/iframe/index.vue'),meta: {title: 'iframe',link:true}},{path: '/redirect',// hidden: true,children: [{path: '/redirect/:path(.*)',component: () => import('@/views/redirect/index.vue')}]}
]
以上 所有的iframe页面都存在/iframe/:id 中 ,用动态路由展示iframe的页面 
以上 brand-list 就是品牌维护的页面路由
App.vue页面
<template><section class="app-main"><router-view v-slot="{ Component, route }" :key="routes.path" v-if="!routes.meta.link"><transition name="fade-transform" mode="out-in"><keep-alive :include="tagsViewStore.cachedViews"><component v-if="!route.meta.link" :is="Component"  /></keep-alive></transition></router-view><iframe-toggle /></section>
</template><script setup>
import iframeToggle from "../IframeToggle/index.vue";
import useTagsViewStore from "@/store/modules/tagsView";
const routes = useRoute()
watch(routes,(val)=>{console.log(val)
})
const tagsViewStore = useTagsViewStore();
</script>
注意一定要给router-view key值,以实现每个iframe页面的变化,router-view都会改变它的路由
iframeToggle页面
<template><inner-linkv-for="(item, index) in uniqBy(iframeViews,'path')":key="item.path":iframeId="'iframe' + index"v-show="route.path === item.path":src="iframeUrl(item.meta.link, item.query)"></inner-link>
</template><script setup>
import InnerLink from "../InnerLink/index.vue";
import useTagsViewStore from "@/store/modules/tagsView";
import { uniqBy } from 'lodash'const route = useRoute();
const tagsViewStore = useTagsViewStore();
const iframeViews = computed(()=>tagsViewStore.iframeViews)// console.log(iframeViews.value)
function iframeUrl(url, query) {// if (Object.keys(query).length > 0) {//   let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&");//   return url + "?" + params;// }return url;
}
</script>
InnerLink页面
<template><div v-loading="loading" :style="'height:' + height"><iframe:id="iframeId"style="width: 100%; height: 100%":src="src"frameborder="no"></iframe></div>
</template><script setup>
const props = defineProps({src: {type: String,default: "/"},iframeId: {type: String}
});
const loading = ref(true)
const height = ref(document.documentElement.clientHeight - 94.5 + "px;")onMounted(() => {setTimeout(() => {loading.value = false;}, 300);window.onresize = function temp() {height.value = document.documentElement.clientHeight - 94.5 + "px;";};
})
</script>
http://www.mmbaike.com/news/93075.html

相关文章:

  • 一个人做网站要多久洛阳seo博客
  • 西宁市城乡建设委员会网站黄冈网站推广软件费用是多少
  • wordpress漫画站主题百度有什么办法刷排名
  • 武汉品牌网站建设公司以下属于网站seo的内容是
  • 腾龙时时彩做号官方网站海南百度推广中心
  • 宝安沙井房价徐州百度快照优化
  • 高端网站建设开发seo排名关键词搜索结果
  • 福建城建设厅官方网站周口搜索引擎优化
  • 网站做实名认证临沂网站seo
  • 郑州路普科技官网关键词优化价格
  • 最大的免费网站建设友情下载网站
  • 日本人真人做真爱的免费网站高佣金app软件推广平台
  • 做网站是什么软件推广网站排名优化seo教程
  • 科技感网站模板小说排行榜百度
  • 磐石市住房和城乡建设局网站天津百度推广电话
  • 天水市建设局企业注册网站百度搜索引擎入口登录
  • 网站建设搜索优化app推广新闻营销深圳网站设计小程序
  • 品牌网站部门建设游戏推广员上班靠谱吗
  • 做吉祥物的网站精准客源
  • 免费搭建企业网站脚上起小水泡还很痒是什么原因
  • 如何创建一个官网解释seo网站推广
  • 陕西省建设银行网站6百度100%秒收录
  • mac本地测试wordpress一个网站的seo优化有哪些
  • 做音乐网站曲库在哪找最近大事件新闻
  • 青岛网站改版关键词排名技巧
  • 网站建设价格槽闸阀在百度如何发布作品
  • 行业网站盈利模式站外seo推广
  • 做网站费用怎么记分录常州seo外包公司
  • 阿里云虚拟主机做企业网站营销新闻
  • 大淘客做网站视频seo网站优化培训怎么样