iview / iview/iview-admin

我增加了对iframe的支持,作者是否考虑加进去呢?

Open
#832 2 comments 1 reaction 0 assignees View on GitHub
helpful
Dominant language
Vue
Stars
16.3k
Forks
4.7k
PR merge metrics
No merged PRs in 30d

Description

实现方式如下:
# 首先修改`/src/view/main/main.vue`

data 中增加定义:`iframes: []`,代码如下:
![image](https://user-images.githubusercontent.com/3143306/43638292-d8a2f61c-974a-11e8-95f5-95b0ffed3f7f.png)

然后:
```




```
增加方法:
```
matchIframes () {
if (this.$route.meta.iframe) {
let name = this.$route.name
let currentFrame = _find(this.iframes, {name: name})
if(this.$route.meta.iframe && !currentFrame) {
this.iframes.push({
href: this.$route.meta.iframe,
name: name
})
}
}
},
```
> 我项目中使用了lodash,所以上面有`_find`,没用lodash的可直接用js原生方式去获取`currentFrame`。

# 最后在定义route的时候指定meta:
```
iframe: url
```
就ok了。如图:
![image](https://user-images.githubusercontent.com/3143306/43638442-701a5a08-974b-11e8-8db4-1faac0c487b9.png)

**希望对大家的思路有帮助!**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in /src/view/main/main.vue and review the existing router-view handling. Compare the proposed iframe list, route meta.iframe values, and iframe rendering behavior with the current routing setup. Done means iframe routes render correctly without breaking normal views, with the change integrated into the project rather than only applied locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.