Vue中父组件传子组件
父组件代码:
<template>
<section :class="menuMode === 'vertical' ? 'vertical-sub-nav' : 'sub-nav'">
<el-menu :mode="menuMode" :default-active="defaultActive" :current-tab="currentTab" @select="handleSelect">
<el-menu-item v-for="(data,ind) in subNavData[currentTab]" :index="data.i" :key="ind">
<span class="p5">
{{data.title}}
</span>
</el-menu-item>
</el-menu>
</section>
</template>
<script>
export default {
name: 'NavMenu',
data() {},
props: {
menuMode: {
type: String,
default: 'horizontal'
},
defaultActive: {
type: String,
default: '0'
},
currentTab: {
type: String,
default: '0'
}
}
}
</script>
子组件代码:
<mp-subnav default-active="0" current-tab="0"></mp-subnav>
Vue中父组件传子组件的更多相关文章
- vue中父级与子组件生命周期的先后顺序
1.vue的生命周期 2.views/createrCustormer.vue为父级 <template> <expressService /> </ ...
- Vue中利用$emit实现子组件向父组件通信
Vue中利用$emit实现子组件向父组件通信 父组件 <template> <div> <p>我是父组件</p> <child :isShow=& ...
- Vue-组件化,父组件传子组件常见传值方式
前言 我们都知道vue核心之一:组件化,vue中万物皆组件,组件化我认为应该来至于模块化的设计思想,比如在模块化开发中,一个模块就是一个实现特定功能的独立的文件,有了模块我们就更方便去阅读代码,更方便 ...
- vue单文件组件形成父子(子父)组件之间通信(vue父组件传递数据给子组件,子组件传递数据给父组件)
看了很多文章,官网文档也有看,对父子组件通信说的不是很明白:决定自己总结一下: vue一般都使用构建工具构建项目:这样每个组件都是单文件组件:而网上很多文章都是script标签方式映入vue,组件通信 ...
- vue-父组件向子组件传值
一.父组件向子组件传值 其实该问题是说子组件如何访问父组件的属性和方法?那么根据对组件化的理解,无非就是要解决两个问题: 1.父组件如何将值传给子组件? 2.子组件如何获取父组件传递过来的值? 解读v ...
- Vue中,父组件向子组件传值
1:在src/components/child/文件夹下,创建一个名为:child.vue的子组件 2:在父组件中,设置好需要传递的数据 3:在App.vue中引入并注册子组件 4:通过v-bind属 ...
- Vue中父组件向子组件传值
Vue中父组件向子组件传值 相关Html: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- Vue 父组件向子组件传值,传方法,传父组件整体
父子组件传值 1.父组件调用子组件时绑定属性,例如-> :title="title" 2.子组件中在props中声明title:props:['title','msg'] 3 ...
- Vue的父子组件v-model双向绑定,父组件修改子组件中绑定的v-model属性
先来看下实现的效果,父组件中有个文本框,在点击下面按钮时弹出抽屉,抽屉里也有个文本框,文本框里的初始值要和父组件的文本框同步,并且修改抽屉里的文本框值时 父组件里的文本框值也要跟着改变 网上有大概三种 ...
随机推荐
- Linux服务器之间进行文件目录映射/挂载(总结)
Linux服务器之间进行文件目录映射/挂载(总结) 需要实现的功能为:将192.168.10.10服务器下的 /home/要映射的目录/ ,映射为192.168.10.90服务器下的 /home/被映 ...
- 再谈反向传播(Back Propagation)
此前写过一篇<BP算法基本原理推导----<机器学习>笔记>,但是感觉满纸公式,而且没有讲到BP算法的精妙之处,所以找了一些资料,加上自己的理解,再来谈一下BP.如有什么疏漏或 ...
- [Swift]LeetCode457. 环形数组循环 | Circular Array Loop
You are given an array of positive and negative integers. If a number n at an index is positive, the ...
- [Swift]LeetCode969.煎饼排序 | Pancake Sorting
Given an array A, we can perform a pancake flip: We choose some positive integer k <= A.length, t ...
- [Swift]LeetCode984. 不含 AAA 或 BBB 的字符串 | String Without AAA or BBB
Given two integers A and B, return any string S such that: S has length A + B and contains exactly A ...
- 【机器学习】--线性回归中soft-max从初始到应用
一.前述 Soft-Max是做多分类的,本身是哪个类别的概率大,结果就为对应的类别.为什么称之为Soft判别,原因是归一化之后的概率选择最大的作为结果,而不是只根据分子. 二.原理 sigmod函数: ...
- Python内置函数(16)——dir
英文文档: dir([object]) Without arguments, return the list of names in the current local scope. With an ...
- Python内置函数(35)——issubclass
英文文档: issubclass(class, classinfo) Return true if class is a subclass (direct, indirect or virtual) ...
- 如何让div内的多行文本上下左右居中
1.首先,如果div中的文本特别少,不超过div宽度,那么这种就非常简单了,直接line-height等于height就可以了 <style type="text/css"& ...
- JVM基础系列第14讲:JVM参数之GC日志配置
说到 Java 虚拟机,不得不提的就是 Java 虚拟机的 GC(Garbage Collection)日志.而对于 GC 日志,我们不仅要学会看懂,而且要学会如何设置对应的 GC 日志参数.今天就让 ...