set value when loading
See original GitHub issueCustom default value, which will be used until the data is loaded for the first time
, but however, how can i set loading value every time with this plugin.
Example, how can i set loading status after i click a btn, and before async data is prepared
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to set value on page load using javascript?
I have to set dynamically text value when page ...
Read more >Loading values for single and multiple value attributes
Within each load item, you can include the supportMultipleValuesForADAttributes configuration property and set it to a different value for each load item. For ......
Read more >how to set default value in data loading function?
I have created a data loading in APEX, and want to record who load the data. so I created one column named user_created....
Read more >Set default values for fields or controls
This article explains how to set a default value for a table field or for a control on a form in an Access...
Read more >13.2.9 LOAD DATA Statement
The operation is subject to the secure_file_priv system variable setting: If the variable value is a nonempty directory name, the file must be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see what you mean, and I see why you want to use
vue-async-computed
for that. Indeed, perhaps this is a reasonable use case forvue-async-computed
.Nevertheless, I feel that the example is slightly stretching what
vue-async-computed
is meant to do: My goal withvue-async-computed
is to make the fact that the computed data is asynchronous completely transparent, so that you can treat it almost exactly the same way you’d treat regular computed properties.But as I said, I do see your use case, and while it is slightly outside the scope of
vue-async-computed
as I originally envisioned it, I agree it’s a reasonable extension.There is an easy, but undocumented, way to get
vue-async-computed
to do this. Hopefully in the future I’ll clean it up and document it properly, if it’s something that people need.You can overwrite an async computed property synchronously within the asyncComputed function, and the computed value will automatically reset to the correct computed value once the promise resolves.
In other words, you can do this:
This will cause the effect you want: Whenever one of the dependencies change, the value of
myData
andmyData2
immediately (actually, on the next tick) take on a value which is a loading message, while at the same time issuing the async request. Then when the async request resolves, the properties go back to having the appropriate computed value.I’m glad you’ve found your solution.
I will keep this in consideration as a formal feature to add in the future. 😃