1.mounted

  1.1mounted中使用$nextTick会导致页面挂掉

 mounted() {
// 页面卡死
this.$nextTick(() => {
this.setUrl()
})
}

2.props

  2.1props传过去的值,第一时间在mounted是获取不到的。因为是异步传值的。

  解决方法:(1)使用watch;(2)将需要进行的处理在父组件进行操作,然后将操作完的值直接传给子组件。

 watch: {
datas: function (val) { }
}

(父)
<examAchSearchHeader :exprotUrl="exprotUrl"></examAchSearchHeader>
...
this.exportUrl = XXXX
(子)
props: {
exportUrl: String
}

  2.2通过props传给子组件的值变化后子组件接收到 和 通过refs访问子组件方法中使用接收到的参数变化的顺序问题

  通过refs访问时,接收到的参数是变化前的参数。还是因为异步的问题。可以强制赋值改变,或用watch等。

 // parent
<examAchTable ref="achTable" :dataList="examAchList"></examAchTable> // 若这里不强制赋值一下,在examAchList变化后直接调用子组件的transData方法时,子组件dataList仍是变化前的值
this.$refs.achTable.dataList = this.examAchList
this.$refs.achTable.transData(res.data.totalRecord) // child
transData(total) {
if (this.dataList)
// ...
}

持续更新中...

Vue笔记(props和 mounted)的更多相关文章

  1. Vue笔记之props验证

    使用props 在Vue中父组件向子组件中传送数据是通过props实现的,一个简单的使用props的例子: <!DOCTYPE html> <html> <head> ...

  2. vue & components & props & methods & callback

    vue & components & props & methods & callback demo solution 1 & props & data ...

  3. vue & watch props

    vue & watch props bug OK watch: { // props // chatObj: () => { // // bug // log(`this.chatObj ...

  4. // mounted: {}, 原来是 空方法 导致了 vue 的警告 !| [Vue warn]: Error in mounted hook: "TypeError: handlers[i].call is not a function"

    // mounted: {}, 原来是 空方法 导致了 vue 的警告 !| vue.runtime.esm.js?2b0e:587 [Vue warn]: Error in mounted hook ...

  5. Vue笔记目录

    Vue笔记目录 一.Vue.js介绍 二.vue基础-vue-cli(vue脚手架) ...持续更新中,敬请期待

  6. [转]Vue中用props给data赋初始值遇到的问题解决

    原文地址:https://segmentfault.com/a/1190000017149162 2018-11-28更:文章发布后因为存在理解错误,经@Kim09AI同学提醒后做了调整,在此深表感谢 ...

  7. Vue中用props给data赋初始值遇到的问题解决

    Vue中用props给data赋初始值遇到的问题解决 更新时间:2018年11月27日 10:09:14   作者:yuyongyu    我要评论   这篇文章主要介绍了Vue中用props给dat ...

  8. Vue computed props pass params

    Vue computed props pass params vue 计算属性传参数 // 计算 spreaderAlias spreaderAlias () { console.log('this. ...

  9. vue & modal props & form data update bug

    vue & modal props & form data update bug OK <div> <BindModal :dialogBindVisible=&qu ...

随机推荐

  1. requirement failed: Unacceptable value for property 'kafka.timeline.metrics.host_in_memory_aggregation', boolean values must be either 'true' or 'false

    requirement failed: Unacceptable value for property 'kafka.timeline.metrics.host_in_memory_aggregati ...

  2. Eureka源码探索(一)-客户端服务端的启动和负载均衡

    1. Eureka源码探索(一)-客户端服务端的启动和负载均衡 1.1. 服务端 1.1.1. 找起始点 目前唯一知道的,就是启动Eureka服务需要添加注解@EnableEurekaServer,但 ...

  3. 从壹开始前后端分离 [ Vue2.0+.NET Core2.1] 二十四║ Vuex + JWT 实现授权验证登录

    壹周回顾 哈喽,又是元气满满的一个周一,又与大家见面了,周末就是团圆节了,正好咱们的前后端也要团圆了,为什么这么说呢,因为以后的开发可能就需要前后端一起了,两边也终于会师了,还有几天Vue系列就基本告 ...

  4. 《深入理解Java虚拟机》-----第4章 虚拟机性能监控与故障处理工具

    理论总是作为指导实践的工具,能把这些知识应用到实际工作中才是 我们的最终目的. 给一个系统定位问题的时候,知识.经验是关键基础,数据是依据,工具是运用知识处理数据的手段.这里说的数据包括:运行日志.异 ...

  5. centos7下搜狗输入法的安装教程

    相信用过centos自带的输入法的朋友都会感叹这也实在是太难用了吧,使用拼音打出来的词总是不能在前几个匹配到,即使是一些常用词也是如此,简直无法忍受跟个zz似的.吐槽完了,这里给出centos7下搜狗 ...

  6. [开发技巧]·AdaptivePooling与Max/AvgPooling相互转换

    [开发技巧]·AdaptivePooling与Max/AvgPooling相互转换 个人网站--> http://www.yansongsong.cn/ 1.问题描述 自适应池化Adaptive ...

  7. python学习第四讲,python基础语法之判断语句,循环语句

    目录 python学习第四讲,python基础语法之判断语句,选择语句,循环语句 一丶判断语句 if 1.if 语法 2. if else 语法 3. if 进阶 if elif else 二丶运算符 ...

  8. Perl多线程(1):解释器线程的特性

    线程简介 线程(thread)是轻量级进程,和进程一样,都能独立.并行运行,也由父线程创建,并由父线程所拥有,线程也有线程ID作为线程的唯一标识符,也需要等待线程执行完毕后收集它们的退出状态(比如使用 ...

  9. 在ASP.NET Core中构建路由的5种方法

    原文链接 :https://stormpath.com/blog/routing-in-asp-net-core 在ASP.NET Core中构建路由的5种方法 原文链接 :https://storm ...

  10. js对象数组(JSON) 根据某个共同字段 分组

    首先判断 var arr = [ {"id":"1001","name":"值1","value": ...