Sponsored Content
Top Forums Web Development Turning jQuery Code into Vue.js Post 303025650 by Neo on Thursday 8th of November 2018 10:15:10 AM
Old 11-08-2018
Thanks Scott... Sorry, I cannot get your suggestions to work.

This "almost" works:

Code:
Vue.component("unix-navbar", {
  template: `<div class="neo-table-border vuenavbar"> <div style="margin-bottom:10px;padding-top:13px;"> <a class="vuenavbarhome" :href="url">{{name}}</a></div> <div id="avatar"  v-on:click="OpenPanel()" style="cursor:pointer;" v-html="theicon" align="center"></div> </div>`,
  data() {
    return {
      thehtml:
        '<span  class="alt1 nav-avatar"><i style="color:#170072;" class="fas fa-user"></i></span>',
      name: "The UNIX and Linux Forums",
      url: "https://www.unix.com/"
    };
  },
  computed: {
    id() {
      return vbuserId;
    },
    theURL() {
      return vbtheURL;
    },
    theavatar() {
      return '<img src="' + this.theURL + '" width="60px"></img>';
    },
    theicon() {
      //if (this.id > 0)
      // return '<img src="' + this.theURL + '" width="60px"></img>';
      return this.thehtml;
    }
  },
  methods: {
    OpenPanel() {
      if (this.userId > 0) openMemberPanel();
      else openLogin();
    }
  }
});

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

But the above code only works for the "theicon" text case in the v-html bindings .... if I change it to "theavatar" in the v-html bindings, it breaks.

In this code, the conditional works based on the vbuserId computed to id in vue.... but the problem that remains is that the "theavatar" case, breaks vue when it does the v-html binding.
 

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
WCWIDTH(3P)						     POSIX Programmer's Manual						       WCWIDTH(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
wcwidth -- number of column positions of a wide-character code SYNOPSIS
#include <wchar.h> int wcwidth(wchar_t wc); DESCRIPTION
The wcwidth() function shall determine the number of column positions required for the wide character wc. The application shall ensure that the value of wc is a character representable as a wchar_t, and is a wide-character code corresponding to a valid character in the cur- rent locale. RETURN VALUE
The wcwidth() function shall either return 0 (if wc is a null wide-character code), or return the number of column positions to be occupied by the wide-character code wc, or return -1 (if wc does not correspond to a printable wide-character code). ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
This function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E), and the return value for a non-printable wide character is not specified. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
wcswidth() The Base Definitions volume of POSIX.1-2008, <wchar.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 WCWIDTH(3P)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy