Top Forums Web Development Turning jQuery Code into Vue.js Post 303025676 by Neo on Friday 9th of November 2018 01:09:30 AM
Old 11-09-2018
I also tried variations of this code, with no joy getting vbuserId changes in the dev console to be reactive in Vue;

Code:
Vue.prototype.$id = vbuserId;
Vue.prototype.$avatar = vbtheURL;

Vue.component("unix-navbar", {
  props: ["myid"],
  template: `<div class="neo-table-border vue-navbar">
        <div  class="vue-site-info">
                <a class="vue-site-link" :href="url">{{name}}</a>
              </div>
              <div id="avatar"  v-html="theavatar" @click="OpenMemberPanel()"></div>
            </div>`,

  data() {
    return {
      name: "The UNIX and Linux Forums",
      url: "https://www.unix.com/"
    };
  },
  computed: {
    theavatar: function() {
      if (this.id > 0)
        return '<img id="avatar-img" src="' + this.$avatar + '"></img>';
      else return '<i id="avatar-icon" class="fas fa-user"></span>';
    },
    id: function() {
      return this.$id;
    }
  },
  methods: {
    OpenMemberPanel() {
      if (this.id > 0) openMemberPanel();
      else openLogin();
    }
  }
});

var vm = new Vue({
  el: "#vue-navbar"
});

Tried various Vue.nextTick() and other Vue methods, but no joy either. And also tried many variations of:

Code:
vm.$el.myid = vbuserId;
vm.myid = vbuserId;

adding [ICODE]myid[/ICODE ]to data() in the component, but no joy.

Again, I must be missing something very basic in Vue Smilie
 

6 More Discussions You Might Find Interesting

1. What is on Your Mind?

JQuery and CSS Flex Code for Responsive WOL Page

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)
Discussion started by: Neo
0 Replies

2. What is on Your Mind?

JQuery and CSS Flex Code for Responsive Forum Home Page

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)
Discussion started by: Neo
1 Replies

3. What is on Your Mind?

JQuery to Add Code Tags to Selected Text

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)
Discussion started by: Neo
0 Replies

4. Web Development

Simple Vue.js Component to Redirect to External Web Page Using Vue Router

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)
Discussion started by: Neo
0 Replies

5. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

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)
Discussion started by: Neo
0 Replies

6. Web Development

Vue.js component: Beautiful code highlighter

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)
Discussion started by: Neo
1 Replies
JOY(4)							   BSD Kernel Interfaces Manual 						    JOY(4)

NAME
joy -- joystick device driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device joy Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): joy_load="YES" In /boot/device.hints: hint.joy.0.at="isa" hint.joy.0.port="0x201" hint.joy.1.at="isa" hint.joy.1.port="0x201" #include <sys/joystick.h> DESCRIPTION
The joystick device driver allows applications to read the status of the PC joystick. This device may be opened by only one process at a time. The joystick status is read from a structure via a read() call. The structure is defined in the header file as follows: struct joystick { int x; /* x position */ int y; /* y position */ int b1; /* button 1 status */ int b2; /* button 2 status */ }; Positions are typically in the range 0-2000. One line perl example: perl -e 'open(JOY,"/dev/joy0")||die;while(1) {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j ";sleep(1);}' ioctl calls Several ioctl() calls are also available. They take an argument of type int * JOY_SETTIMEOUT int *limit Set the time limit (in microseconds) for reading the joystick status. Setting a value too small may prevent to get correct values for the positions (which are then set to -2147483648), however this can be useful if one is only interested by the buttons status. JOY_GETTIMEOUT int *limit Get the time limit (in microseconds) used for reading the joystick status. JOY_SET_X_OFFSET int *offset Set the value to be added to the X position when reading the joystick status. JOY_SET_Y_OFFSET int *offset Set the value to be added to the Y position when reading the joystick status. JOY_GET_X_OFFSET int *offset Get the value which is added to the X position when reading the joystick status. JOY_GET_Y_OFFSET int *offset Get the value which is added to the Y position when reading the joystick status. TECHNICAL SPECIFICATIONS
The pinout of the DB-15 connector is as follow: 1 XY1 (+5v) 2 Switch 1 3 X1 (potentiometer #1) 4 Switch 1 (GND) 5 Switch 2 (GND) 6 Y1 (potentiometer #2) 7 Switch 2 8 N.C. 9 XY2 (+5v) 10 Switch 4 11 X2 (potentiometer #3) 12 Switch 3&4 (GND) 13 Y2 (potentiometer #4) 14 Switch 3 15 N.C. Pots are normally 0-150k variable resistors (0-100k sometimes), and according to the IBM technical reference, the time is given by Time = 24.2e-6s + 0.011e-6s * R/Ohms FILES
/dev/joy? joystick device files HISTORY
The joy driver appeared in FreeBSD 2.0.5. AUTHORS
Jean-Marc Zucconi <jmz@cabri.obs-besancon.fr> BSD
January 23, 1995 BSD

Featured Tech Videos

All times are GMT -4. The time now is 06:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy