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
WML_TAGS(7)							     EN Tools							       WML_TAGS(7)

NAME
WML Tag Index - Permutated index of defined WML tags DESCRIPTION
This documents provides a permutated index of all defined WML tags, both in the core languages and the include files. The index is sorted alphabetically. CORE LANGUAGES
# wml_p1_ipp(3) #!wml wml(1) #depends wml_p1_ipp(3) #include wml_p1_ipp(3) #use wml_p1_ipp(3) $(...) wml_p1_ipp(3) %!slice slice(1) ..NAME>> wml_p5_divert(3) :#NAME#} wml_p5_divert(3) <: ... :> eperl(1) <:= ... :> eperl(1) <<NAME.. wml_p5_divert(3) <<NAME>> wml_p5_divert(3) <__file__> mp4h(1) <__line__> mp4h(1) <__version__> mp4h(1) <add> mp4h(1) <and> mp4h(1) <array-add-unique> mp4h(1) <array-concat> mp4h(1) <array-member> mp4h(1) <array-pop> mp4h(1) <array-push> mp4h(1) <array-shift> mp4h(1) <array-size> mp4h(1) <array-topvalue> mp4h(1) <at-end-of-file> ... </at-end-of-file> mp4h(1) <attributes-extract> mp4h(1) <attributes-quote> mp4h(1) <attributes-remove> mp4h(1) <bind_textdomain_codeset> intl:gettext(3) <bindtextdomain> intl:gettext(3) <break> mp4h(1) <bs> mp4h(1) <capitalize> mp4h(1) <char-offsets> mp4h(1) <comment> ... </comment> mp4h(1) <compound> ... </compound> mp4h(1) <copy-var> mp4h(1) <date> mp4h(1) <debugfile> mp4h(1) <debugging-off> mp4h(1) <debugging-on> mp4h(1) <debugmode> mp4h(1) <decrement> mp4h(1) <define-entity> ... </define-entity> mp4h(1) <define-tag> ... </define-tag> mp4h(1) <defvar> mp4h(1) <directory-contents> mp4h(1) <disjoin> mp4h(1) <divert> mp4h(1) <divide> mp4h(1) <divnum> mp4h(1) <dnl> mp4h(1) <downcase> mp4h(1) <dq> mp4h(1) <eq> mp4h(1) <exit> mp4h(1) <expand> mp4h(1) <file-exists> mp4h(1) <foreach> ... </foreach> mp4h(1) <frozen-dump> mp4h(1) <function-def> mp4h(1) <get-file-properties> mp4h(1) <get-hook> mp4h(1) <get-var-once> mp4h(1) <get-var> mp4h(1) <gettext>...</gettext> intl:gettext(3) <group> mp4h(1) <gt> mp4h(1) <if> mp4h(1) <ifeq> mp4h(1) <ifneq> mp4h(1) <include> mp4h(1) <increment> mp4h(1) <lb> mp4h(1) <let> mp4h(1) <load> mp4h(1) <lt> mp4h(1) <match> mp4h(1) <max> mp4h(1) <min> mp4h(1) <modulo> mp4h(1) <mp4h-l10n> mp4h(1) <mp4h-output-radix> mp4h(1) <multiply> mp4h(1) <neq> mp4h(1) <noexpand> mp4h(1) <nostrip>...</nostrip> wml_p8_htmlstrip(3) <not> mp4h(1) <or> mp4h(1) <preserve> mp4h(1) <printf> mp4h(1) <protect>...</protect> wml(1) <provide-tag> ... </provide-tag> mp4h(1) <rb> mp4h(1) <real-path> mp4h(1) <restore> mp4h(1) <return> mp4h(1) <set-eol-comment> mp4h(1) <set-hook> ... </set-hook> mp4h(1) <set-quotes> mp4h(1) <set-var-verbatim> mp4h(1) <set-var-x> ... </set-var-x> mp4h(1) <set-var> mp4h(1) <sort> mp4h(1) <string-compare> mp4h(1) <string-eq> mp4h(1) <string-length> mp4h(1) <string-neq> mp4h(1) <subst-in-string> mp4h(1) <subst-in-var> mp4h(1) <substract> mp4h(1) <substring> mp4h(1) <suck> wml_p8_htmlstrip(3) <symbol-info> mp4h(1) <textdomain> intl:gettext(3) <timer> mp4h(1) <undef> mp4h(1) <undivert> mp4h(1) <unset-var> mp4h(1) <upcase> mp4h(1) <use> mp4h(1) <var-case> mp4h(1) <var-exists> mp4h(1) <warning> mp4h(1) <when> ... </when> mp4h(1) <while> ... </while> mp4h(1) [NAME:...:NAME] slice(1) [NAME:...:] slice(1) [[..]] wml_p6_asubst(3) wml_p1_ipp(3) __END__ wml_p1_ipp(3) __FILE__ wml_p1_ipp(3) __LINE__ wml_p1_ipp(3) m4_define m4(1) m4_ifdef m4(1) m4_ifelse m4(1) m4_noquote m4(1) m4_quote m4(1) m4_undefine m4(1) {#NAME#: wml_p5_divert(3) {#NAME#} wml_p5_divert(3) {: ... :} wml_p6_asubst(3) INCLUDE FILES
<array:pop> wml::std::tags(3) <array:push> wml::std::tags(3) <array:show> wml::std::tags(3) <array:size> wml::std::tags(3) <array:topvalue> wml::std::tags(3) <asubst>...</asubst> wml::std::tags(3) <big> wml::des::typography(3) <box>...</box> wml::std::box(3) <case:lower>...</case:lower> wml::std::case(3) <case:upper>...</case:upper> wml::std::case(3) <cell>...</cell> wml::std::grid(3) <concat>...</concat> wml::sys::compat1(3) <csc>..</csc> wml::des::typography(3) <csmap> wml::imp::csmap(3) <default-value> wml::mod::MakeMaker(3) <define-container>...</define-container> wml::sys::compat1(3) <defmacro>...</defmacro> wml::sys::compat1(3) <defsubst>...</defsubst> wml::sys::compat1(3) <divert>...</divert> wml::std::tags(3) <ds> wml::des::typography(3) <dump> wml::std::tags(3) <ein> wml::des::typography(3) <enter> wml::std::tags(3) <fsview> wml::imp::fsview(3) <gesperrt>..</gesperrt> wml::des::typography(3) <gfont>...</gfont> wml::des::gfont(3) <grid>...</grid> wml::std::grid(3) <head>...</head> wml::std::page(3) <headline>..</headline> wml::des::typography(3) <href> wml::std::href(3) <hspace> wml::des::space(3) <ifdef> wml::std::tags(3) <imgbg> wml::des::imgbg(3) <imgdot> wml::des::imgdot(3) <import> wml::imp::generic(3) <info:document-url> wml::std::info(3) <info> wml::std::info(3) <isolatin>..</isolatin> wml::fmt::isolatin(3) <javascript>...</javascript> wml::std::tags(3) <label> wml::std::label(3) <lang:area>...</lang:area> wml::std::lang(3) <lang:new> wml::std::lang(3) <lang:set-wildcard> wml::std::lang(3) <lang:star:> wml::std::lang(3) <lang:star:href:> wml::std::lang(3) <lang:star:slice:> wml::std::lang(3) <leave> wml::std::tags(3) <logo> wml::std::logo(3) <lowsrc> wml::des::lowsrc(3) <m4>...</m4> wml::std::tags(3) <mod>...</mod> wml::sys::compat1(3) <mul>...</mul> wml::sys::compat1(3) <navbar:button> wml::des::navbar(3) <navbar:debug> wml::des::navbar(3) <navbar:define>...</navbar:define> wml::des::navbar(3) <navbar:epilog>...</navbar:epilog> wml::des::navbar(3) <navbar:filter>...</navbar:filter> wml::des::navbar(3) <navbar:footer>...</navbar:footer> wml::des::navbar(3) <navbar:header>...</navbar:header> wml::des::navbar(3) <navbar:open> wml::des::navbar(3) <navbar:prolog>...</navbar:prolog> wml::des::navbar(3) <navbar:render> wml::des::navbar(3) <over>...</over> wml::des::space(3) <page> wml::std::page(3) <perl:assign:sq> wml::std::tags(3) <perl:assign> wml::std::tags(3) <perl:print:> wml::std::tags(3) <perl:print:var> wml::std::tags(3) <perl:print>...</perl:print> wml::std::tags(3) <perl>...</perl> wml::std::tags(3) <pi> wml::des::typography(3) <pod>..</pod> wml::fmt::pod(3) <preload> wml::des::preload(3) <prog>...</prog> wml::sys::compat1(3) <ps> wml::des::typography(3) <ref> wml::std::label(3) <require> wml::mod::version(3) <rollover> wml::des::rollover(3) <say>...</say> wml::std::tags(3) <sc>..</sc> wml::des::typography(3) <sdf>..</sdf> wml::fmt::sdf(3) <space> wml::des::space(3) <spaced>..</spaced> wml::des::typography(3) <sub>...</sub> wml::sys::compat1(3) <subheadline>..</subheadline> wml::des::typography(3) <symbol> wml::std::tags(3) <text>..</text> wml::fmt::text(3) <title>...</title> wml::std::page(3) <tli> wml::des::typography(3) <toc> wml::std::toc(3) <toc_hX> wml::std::toc(3) <tul>..</tul> wml::des::typography(3) <ue>..</ue> wml::des::typography(3) <url>..</url> wml::fmt::url(3) <verbatim-file> wml::fmt::verbatim(3) <verbatim>..</verbatim> wml::fmt::verbatim(3) <verbcode>..</verbcode> wml::des::typography(3) <vspace> wml::des::space(3) <write-makefile> wml::mod::MakeMaker(3) <xtable>..</xtable> wml::fmt::xtable(3) <zwue>..</zwue> wml::des::typography(3) SEE ALSO
wml(1), wml_p1_ipp(3), mp4h(1), eperl(1), m4(1), wml_p5_divert(3), wml_p6_asubst(3), wml_p7_htmlfix(3), wml_p8_htmlstrip(3), slice(1), wml::all(3) EN Tools 2014-04-16 WML_TAGS(7)

Featured Tech Videos

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