验证码: 看不清楚,换一张 查询 注册会员,免验证
  • {{ basic.site_slogan }}
  • 打开微信扫一扫,
    您还可以在这里找到我们哟

    关注我们

vue项目怎么通过url链接引入其他系统页面

阅读:520 来源:乙速云 作者:代码code

vue项目怎么通过url链接引入其他系统页面

      vue通过url链接引入其他系统页面

      1.正常配置菜单

      在vue页面使用iframe进行嵌套加载其它系统的页面,已加载百度为例

      
      

      效果图:

      vue项目怎么通过url链接引入其他系统页面

      2.加载引入系统可能会出现拦截

      xxx 拒绝了我们的连接请求。

      前端页面Refused to display 'xxx' in a frame because it set 'X-Frame-Options' to 'sameorigin',对于这个问题我们需要在引入的项目中进行拦截处理,引入项目中response.addHeader("x-frame-options","SAMEORIGIN")需要改写为response.addHeader("x-frame-options","ALLOW-FROM http://127.0.0.1:项目端口/");对访问方式进行允许iframe不同域名之间进行调动

      vue项目怎么通过url链接引入其他系统页面

      3.引入项目的后台拦截代码

      @Configuration
      public class MvcConfig implements WebMvcConfigurer {
         //配置日志
          private static final Logger logger= LoggerFactory.getLogger(MvcConfig.class);
          
          @Autowired
          SystemConfig systemConfig;
         
          @Override
          public void addInterceptors(InterceptorRegistry registry) {
              registry.addInterceptor(new HandlerInterceptor() {
                  @Override
                  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
                      //设置日志级别
                      //logger.debug("前置方法被执行");
                      return true;
                  }
       
                  @Override
                  public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
                      //logger.info("后置方法被执行");
                      //System.out.println(systemConfig.getMqiUrl());
                      if(null == modelAndView){
                          return;
                      }
                      response.addHeader("x-frame-options","ALLOW-FROM http://127.0.0.1:8004/");
      
                      modelAndView.getModelMap().addAttribute("arcgisserviceUrl", systemConfig.getArcgisserviceUrl());
                  }
       
                  @Override
                  public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
                      //logger.debug("最终方法被执行");
                  }
              });
          }
      }

      vue页面嵌套外部url

      我的需求是一进入页面通过调接口获取页面的url,然后把url嵌套到当前页面。

      
      
      
    分享到:
    *特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: hlamps#outlook.com (#换成@)。
    相关文章
    {{ v.title }}
    {{ v.description||(cleanHtml(v.content)).substr(0,100)+'···' }}
    你可能感兴趣
    推荐阅读 更多>