Answers for "vuejs"

2

vuejs

// Basic VueJS Example Template

<template>
  <div class="myClass" ref>
    <slot></slot>
  </div>
</template>

<script>
export default {
  data() {
    return {
      myData: "Hello World!"
    }
  },
  mounted() {
    this.myMethod();
  },
  methods: {
    myMethod() {
      console.log(this.myData);
    }
  }
}
</script>

<style scoped>
.myClass {
  padding: 1em
}
<style>
Posted by: Guest on July-22-2021
2

vuejs

<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
Posted by: Guest on December-25-2020
1

vuejs

<div id="app">
  {{ message }}
</div>
Posted by: Guest on July-10-2020
1

vuejs

var app2 = new Vue({
  el: '#app-2',
  data: {
    message: 'You loaded this page on ' + new Date().toLocaleString()
  }
})
Posted by: Guest on May-24-2021
0

vuejs

// file name: index.vue
// structure for vue 2
<template>
  // HTML code 
  // within one element for vue2
</template>
<script>
// js code
export default {
	components: {
      // vue component to use in html
    },
    data () {
      return{
        // all global variables should be declear here
        // this.varName to access variable
        randomVar: 12,
        randomVar2: "Suman"
      }
    },
    computed:{
      // act as variable
      // syntex will be same as function
      // return value will be stored 
    },
    methods: {
      // all global function should be declear here
      // you can use all js syntex here
    },
    mounted (){
      // all other js code to be execuated here (my suggestion)
      // this is a part of "vue-lifecycle"
      // for more details: 
      // https://vuejs.org/v2/guide/instance.html#Lifecycle-Diagram
    }
}
</script>
<style scoped>
// css code
// scoped will enclose all css code within this vue file
</style>
Posted by: Guest on July-21-2021
0

vuejs

const CounterApp = {
  data() {
    return {
      counter: 0
    }
  },
  mounted() {
    setInterval(() => {
      this.counter++
    }, 1000)
  }
}
Posted by: Guest on August-17-2020
2

vuejs

Best front framework ! :)
Posted by: Guest on January-18-2021
-1

vuejs

<div id="app-2">
  <span v-bind:title="message">
    Hover your mouse over me for a few seconds
    to see my dynamically bound title!
  </span>
</div>
Posted by: Guest on October-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language