Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get attr in vuejs

<script src="https://unpkg.com/vue"></script>

<div id="app">
  <my-comp my-attr="Any value"></my-comp>
</div>

<script>
  Vue.component('my-comp', {
    template: '<div>aaa</div>',
    created: function () {
      console.log(this.$attrs['my-attr']) // And here is - in $attrs object
    }
  })

  new Vue({
    el: '#app'
  })
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: remove line break javascript 
Javascript :: app.post (req res) get data 
Javascript :: detect if two line segments intersect each other javascript 
Javascript :: how to collect keys using lodash javascript 
Javascript :: fetch await reactjs 
Javascript :: ajax syntax in javascript 
Javascript :: javascript group by key 
Javascript :: es ignore 
Javascript :: link react router dom 
Javascript :: onclick change image javascript example 
Javascript :: collapse uncollapse jquery 
Javascript :: found page without a React Component as default export in 
Javascript :: js convert date to timestamp 
Javascript :: react forms 
Javascript :: how to get element by id 
Javascript :: javascript dir 
Javascript :: regex optional whitespace characters 
Javascript :: finding an element ina na array in js 
Javascript :: jquery hover and hover out 
Javascript :: pyramid javascript 
Javascript :: js copy to clipboard 
Javascript :: number format currency 
Javascript :: react app js 
Javascript :: search functionality in jquery 
Javascript :: PayloadTooLargeError 
Javascript :: slice javascript string 
Javascript :: reactstrap form post 
Javascript :: how to click on the datepicker date in jquery 
Javascript :: how to run commands in the command prompt using javascript 
Javascript :: vue cors 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =