Use vue to implement code for sliding out of the Panel by clicking the button, vue button

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.