Saturday 18 November 2017

Vue JS In Salesforce

Arpit Sharma

Now MIT Developer come up with new Javascript framework under MIT License i.e Vue.js. It is cross platform framework and written in javascript. Vue.js is a progressive framwork means Reliable, Fast, Engaging. It can be easily integrated with existing projects. It can also used to create single page application with Support Libraries and Modern Tooling.

Prerequisite

To Learn Vue.Js Developer need to intermediate knowledge of Javascript, CSS, HTML.

How to Use in Vue.js in Salesforce - 

1. Download Vue.js from here.
2. Upload into static Resource.
3. Create new Page Named VueJsExample add following code 
  • First we give id to element in HTML.
  • Then in JS set that element to be app using Id with help of Vue.js capabality.
  • Then set properties of app.

<apex:page>
   <apex:includeScript value="{!$Resource.vuejs}"/>
   <div id="app">
      <p>{{ message }}</p>
   </div>
   <script>
      var app = new Vue({
          el: '#app',
          data: {
          message: 'Salesforce With View.js'
          }
      })
   </script>
</apex:page>


Now we have created first vue app In this example if change value of app.message dynamically then message value automatically change in html same as angular.