In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the javascript fast application stack overflow how to do, the article is very detailed, has a certain reference value, interested friends must read it!
A short code snippet describes the problem where $element ('id') is assigned to a member variable and a stack overflow occurs, as well as a solution to fix it.
When assigning the acquired content $element ('id') to a member variable, RangeError: Maximum call stack size exceeded may have a stack overflow (), causing the program to crash. A stack overflow also occurs if a member variable reference exists in a DOM and the member variable changes. The sample code is as follows:
{{stateText}} export default {private: {mContentNode: null, stateText: 'init state'}, onReady () {/ * When data obtained by $element (' id') is assigned to a member variable, a stack overflow may occur. * / this.mContentNode = this.$element ('content')}, onTestClick () {/ * To reproduce this problem, change a member variable when member variable references exist for a DOM. * / this.stateText = 'new state'}}
The reason is that assignment can lead to massive changes in data. This results in an internal exception loop, resulting in a stack overflow.
Solution
To prevent stack overflows, you can assign the acquired data to $element ('id') local or global variables instead of member variables. The sample code is as follows:
Let $gContentNode = null export default {private: {stateText: 'init state'}, onReady () {/ * You can assign the data obtained through $element (' id') to a local or global variable to prevent the stack overflow. * / const cContentNode = this.$element ('content') $gContentNode = this.$element (' content')}, onTestClick () {this.stateText = 'new state'}} these are all the contents of the article "what to do about stack overflow in fast applications in javascript". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.