简体   繁体   English

获取前实例Vue的prop的值

[英]Get the value of a prop of the before instance Vue

Is possible to save the value of a prop in the data of the component for the next renderizing? 是否可以在下一次重新定义的组件数据中保存prop的值? I mean, I want to update the data component from Vue and in the new instance get the value of a prop of the before instance 我的意思是,我想从Vue更新数据组件,并在新实例中获取before实例的prop的值

As you have stated, re-rendering means just that...rendering again. 正如您所说,重新渲染意味着......再次渲染。 :) So the short answer would be no, you can not save prop value within a component and use it after re-rendering. :)所以简短的答案是否定的,你不能在组件中保存prop值并在重新渲染后使用它。

You say that every minute you are fetching some data that later on you will be doing some logic on. 你说你每分钟都在获取一些数据,以后你会做一些逻辑。 As suggested use Vuex for that, save that data before re-rendering and the use it as you like. 正如建议的那样使用Vuex,在重新渲染之前保存该数据并根据需要使用它。

One of many Vue.JS good point is a very well written documentation. 许多Vue.JS中的一个好点是写得很好的文档。 You need Vuex so here it is: https://vuex.vuejs.org/ 你需要Vuex所以这里是: https ://vuex.vuejs.org/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM