Sponsored Content
Top Forums Web Development Turning jQuery Code into Vue.js Post 303025665 by Scott on Thursday 8th of November 2018 02:50:21 PM
Old 11-08-2018
The problem in the end was in the vB Template, where $jsGlobalsfromvB was given after the Vue components were loaded, meaning that vbuserId and vbtheURL were not set at the time the components were rendered.

Here's the final, working version:
Code:
Vue.component("unix-navbar", {
  template: `<div class="neo-table-border vuenavbar">
              <div class="flex-item" style="margin-bottom:10px;padding-top:13px;">
                <a class="vuenavbarhome" :href="url">{{name}}</a>
              </div>
              <div id="avatar" class="flex-item"  v-html="theavatar" @click="OpenMemberPanel()" style="cursor:pointer;" align="center"></div>
            </div>`,

  data() {
    return {
      unixtime: '',
      name: "The UNIX and Linux Forums",
      url: "https://www.unix.com/",
      theavatar: ''
    };
  },
  methods: {
    GetAvatar() {
      if ( vbuserId > 0 )
        this.theavatar = '<img src="' + vbtheURL + '" width="60px"></img>';
      else
        this.theavatar =
          '<span class="alt1" style="font-size:3em;cursor:pointer;float:right;background-color:transparent;margin-right:5px;margin-left:10px;top:0;padding:20px;" ><i style="color:#170072;" class="fas fa-user"></i></span>';
    },
    UpdateTime() {
      this.unixtime = Math.round(new Date().getTime() / 1000);
    },
    OpenMemberPanel() {
      if ( vbuserId > 0 )
        openMemberPanel();
      else
        openLogin();
    }
  },
  created() {
    setInterval(() => {
      this.UpdateTime();
    }, 1000);

    this.GetAvatar();
  }
});

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

This User Gave Thanks to Scott For This Post:
 

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
ldns-read-zone(1)					      General Commands Manual						 ldns-read-zone(1)

NAME
ldns-read-zone - read a zonefile and print it SYNOPSIS
ldns-read-zone ZONEFILE DESCRIPTION
ldns-read-zone reads a DNS zone file and prints it. The output has 1 resource record per line, and no pretty-printing makeup. OPTIONS
-c Canonicalize all resource records in the zone before printing -d Only print DNSSEC data from the zone. This option skips every record that is not of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are not printed. -h Show usage and exit -n Do not print the SOA record -s Strip DNSSEC data from the zone. This option skips every record that is of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are still printed. -S [[+|0]number | YYYYMMDDxx | unixtime ] Set serial number to the given number, or when preceded by a sign, offset the exisiting number with it. When giving the literal strings YYYYMMDDxx or unixtime, the serial number is tried to be reset in datecounter or in unixtime format respectively. Though is the updated serial number is smaller than the original one, the original one is simply increased by one. When updating a serial number, records of type NSEC, NSEC3, RRSIG and DNSKEY will be skipped when printing the zone. -v Show the version and exit -z Sort the zone before printing (this implies -c) AUTHOR
Written by the ldns team as an example for ldns usage. REPORTING BUGS
Report bugs to <ldns-team@nlnetlabs.nl>. COPYRIGHT
Copyright (C) 2005 NLnet Labs. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. 30 May 2005 ldns-read-zone(1)
All times are GMT -4. The time now is 12:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy