JavaScript workaround for setting part of attribute (for font-awesome icon) in vue 2 template without interpolation?

I'm trying to create a component using vue.js, where the component contains a font-awesome icon, which is supplied in template. For example, I'd like to be able to use <big-nav-item icon="fa-phone" word="contact"> and have the font-awesome phone icon and the word contact land in my component.

The problem is that font-awesome icons take their identifier in the attributes of the element, and Vue.js 2.0 doesn't seem to want to use interpolation in element attributes. So the following code fails:

Vue.component("big-nav-item", {
    props: ["icon", "word"],
    template: '<div class="three columns"><span class="fa-stack fa-3x"><i class="fa {{ icon }} fa-stack-2x"></i><span class="fa fa-stack-1x" style="margin-top:50%; font-size:20px; font-weight:bold;">{{ word }}</span></span></div>'
});

because Vue won't let me pass the fa-phone bit into the component via the template. Instead it throws an error:

Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div class="{{ val }}">, use <div :class="val">.

Does anyone know of a good workaround for this? The only thing I can think of trying, which seems super-awkward, would be to write a method for the component that uses raw string concatenation to build up the entire icon element and then insert the whole thing in the template. I guess I'll try that if there isn't a standard solution to this problem...

Answer:1

I'm in the middle of implementing server sent event using Django. HTML <script type='text/javascript'> var source = new EventSource('/pro_listen'); console.log(source); source....

I'm in the middle of implementing server sent event using Django. HTML <script type='text/javascript'> var source = new EventSource('/pro_listen'); console.log(source); source....

  1. setup server side sync dynamics 365
  2. setup server side rules outlook 2013
  3. setup server side rules outlook 2010
  4. setup server side synchronization
  5. setup server side
  6. setup react server side rendering
  7. outlook setup server side rules
  8. setup guide server-side synchronization for crm online
  9. sql server setup server side trace
  10. how to setup server side exchange rules
  11. dynamics crm setup server side sync

I am working on Angular2 project in which i need to generate dynamic function which will be able to call the service provided under the service class. The service class has some 10 get functions as ...

I am working on Angular2 project in which i need to generate dynamic function which will be able to call the service provided under the service class. The service class has some 10 get functions as ...

  1. dynamic function call javascript
  2. dynamic function call python
  3. dynamic function call typescript
  4. dynamic function call in php
  5. dynamic function call angular
  6. dynamic function call
  7. dynamic function call failed
  8. dynamic function call java
  9. dynamic function call golang
  10. dynamic function call c++
  11. dynamic function call abap
  12. dynamic function call in jquery
  13. dynamic function call swift
  14. dynamic function call ruby
  15. dynamic function call in vba
  16. dynamic function call r
  17. dynamic function call powershell
  18. pl sql dynamic function call
  19. dynamic call function name
  20. javascript dynamic function call with arguments

I keep getting this error from ESLint on my component. ESLint: says Prefer Default Export (import/prefer-default-export) Here's is how the component looks export class mycomponent extends React....

I keep getting this error from ESLint on my component. ESLint: says Prefer Default Export (import/prefer-default-export) Here's is how the component looks export class mycomponent extends React....

  1. react functional components eslint
  2. eslint react component never used
  3. eslint react component unused
  4. eslint react component
  5. eslint react component name

I have encountered a problem where a sequence of SignalR hub function fails to be executed asynchronously. I have: //Hub functions //Initializing hub server and clients. function HubStart() { $....

I have encountered a problem where a sequence of SignalR hub function fails to be executed asynchronously. I have: //Hub functions //Initializing hub server and clients. function HubStart() { $....

  1. typescript async await
  2. typescript async await example
  3. typescript async await return value
  4. typescript async await promise
  5. typescript async await observable
  6. typescript async await error handling
  7. typescript async await es5
  8. typescript async await return type
  9. typescript async await try catch
  10. typescript async await vs promise
  11. typescript async await foreach
  12. typescript async await catch
  13. typescript async await promise example
  14. typescript async await map
  15. typescript async await return promise
  16. typescript async await tutorial
  17. typescript async await http request
  18. typescript async await for loop
  19. typescript async await vs observable
  20. typescript async await constructor