Sponsored Content
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
MARC::Charset::Code(3pm)				User Contributed Perl Documentation				  MARC::Charset::Code(3pm)

NAME
MARC::Charset::Code - represents a MARC-8/UTF-8 mapping SYNOPSIS
DESCRIPTION
Each mapping from a MARC-8 value to a UTF-8 value is represented by a MARC::Charset::Code object in a MARC::Charset::Table. METHODS
new() The constructor. name() A descriptive name for the code point. marc() A string representing the MARC-8 bytes codes. ucs() A string representing the UCS code point in hex. charset_code() The MARC-8 character set code. is_combining() Returns true/false to tell if the character is a combining character. to_string() A stringified version of the object suitable for pretty printing. char_value() Returns the unicode character. Essentially just a helper around ucs(). marc_value() The string representing the MARC-8 encoding. charset_name() Returns the name of the character set, instead of the code. to_string() Returns a stringified version of the object. marc8_hash_code() Returns a hash code for this Code object for looking up the object using MARC8. First portion is the character set code and the second is the MARC-8 value. utf8_hash_code() Returns a hash code for uniquely identifying a Code by it's UCS value. default_charset_group Returns 'G0' or 'G1' indicating where the character is typicalling used in the MARC-8 environment. get_marc8_escape Returns an escape sequence to move to the Code from another marc-8 character set. charset_value Returns the charset value, not the hex sequence. perl v5.12.4 2010-03-29 MARC::Charset::Code(3pm)
All times are GMT -4. The time now is 11:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy