Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Also, for completeness, I changed the GetAvatar() method to a computed property and it works as well. I personally like this method because it is a few less lines of code and it's easy to use the dev tools Vue debugger to look at the computed data:
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
What you propose did not change the fact it is not reactive to the JS var.
When I change vbuserId in the dev console, it it worked (was reactive), the avatar would change; but it does not change.
If the conditional in vue is from data(), computed: or from a method: all will change the value internal to Vue, but what I am trying to
do is get Vue to react to changes in the variable in the console which simulates a change outside of Vue.
IMHO, it is not related to data(), computed: or from a method directly, and there is something that needs to be added to get Vue to react (bind) to an external change outside of vue.
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Update:
After looking into this; it seems that it's not really in the design of Vue.js to bind and react to Javascript variables outside the Vue instance sandbox.
No big deal... we can manage without this capability and indeed, as Scott has pointed out to me, there are probably good security reasons for this design (Vue.js as a sandbox).
However, in the interest of being complete, I asked this question over at the Vue forums:
My "security" suggestion was just a guess.. probably not a very good one, or the right one for the wrong reasons! Encapsulation is good!
When the Vue instance is instantiated the execution context in JS knows about vbuserId, but that doesn't bind it in any way to the Vue instance. I've googled it to death, and can't find a way to make that happen. But it's certainly easy to update both, outside of the context of the Vue components with, for example, a function:
Of course, to anyone who is concerned, this vbuserId is only used for the purposes of displaying an avatar (and only either your own or the default, silhouette one, and doesn't "make you" that user
Sooner than later I will render forum discussions in Vue.js to complement the standard way of showing forum threads.
Today, I ran across this component, vue-code-highlight
Beautiful code syntax highlighting as Vue.js component.
https://www.unix.com/members/1-albums225-picture1199.jpg
... (1 Reply)
A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series:
... (0 Replies)
Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library.
After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far):
Component Example: ... (0 Replies)
Hey.
Someone find or write some jQuery code where we can select text with our mouse and then click or double click the highlighted / selected text and then it will wrap code tags around the highlighted text (in our editors).
:) (0 Replies)
So far, I have completed making the home page more responsive (except for the forum stats at the top and the WOL box at the bottom, they still use scroll bars).
xevV3_iZ8-s
For full screen use the link below and set your YT resolution to 1080p60 HD
https://youtu.be/xevV3_iZ8-s
Here is... (1 Reply)
I have just wrote this jQuery to the WOL page, so the table of users on line will not need scrollbars and will instead transform into a responsive table:
<script>
jQuery(document).ready(function (){
jQuery("#neo-who-flex-tcat").
css({"display":"flex","flex-flow":"row wrap",
... (0 Replies)