elementui 弹出层新页面
时间: 2023-10-04 14:06:41 浏览: 104
ElementUI弹出层新页面的实现通过将新页面作为组件引入,并在需要弹出新页面的地方使用该组件。首先,在父页面(A页面)中将需要引入的组件(B页面)进行引入和注册,代码如下:
```
import dialogPage from '../dialogPage/index.vue'
export default {
components: {
dialogPage
},
...
}
```
然后,在HTML代码中使用该组件来实现弹出新页面的效果,并传递相应的参数,如下:
```
<dialogPage v-if="formPageVisible" ref="formPageRef" :queryId="logDialog.queryId"></dialogPage>
```
其中,`formPageVisible`是一个显示参数,用于控制新页面的显示与隐藏。在调用弹出新页面的方法中进行如下设置:
```
methods: {
...
showLog(obj) {
// 显示新页面
this.formPageVisible = true;
// 传递参数
this.queryId = obj.queryId;
// 调用子页面方法
this.$nextTick(() => {
this.$refs.formPageRef.getlist();
});
}
}
```
通过设置`formPageVisible`为`true`来显示新页面,同时传递参数`queryId`给新页面组件。然后调用新页面组件的方法`getlist()`来执行相应的逻辑操作。这样就实现了通过ElementUI弹出层在父页面中打开新页面的效果。