Use vue to implement code for sliding out of the Panel by clicking the button, vue button
Communication is prone to errors, or information cannot be transmitted. Here is an example of how to complete the click event through communication between components.
In the index. vue file:
<Div> <el-button type = "primary" @ click = "onShow"> click me </el-button> </div>
Transfer Intermediary
<addForm :show="formShow" @onHide="formShow = false"></addForm>
Introduce components, that is, components to be popped up
import addForm from './docsForm'export default {components: {addForm},data() {return {show: false,formShow: false}},watch: { show: { handler: function(newVal, oldVal) { this.show = newVal }, deep: true }},methods: {onShow() { this.formShow = true }}}
The method in this file is as follows.
Then how to upload data to the component docsForm. vue is displayed
<SlidePanel: width = "550 ": show = "show" title = "add knowledge" @ changeShow = "hide"> <div class = "docs-body"> </div> </slidePanel> export default {props: {show: false}, methods: {hide () {this. $ emit ('onhide ')},}
In the slidePanel. vue component
<template> <transition name="slide-panel-fade"> <div v-if="show" class="slide-panel" :style="{ width: width + 'px'}"> <div class="slide-panel-layout"> <div class="slide-panel-header">
In this way, you can pull the volumes between different components.
The above is the implementation code of clicking the button to slide out the panel using vue. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!