title: How do I get a literal expression from a custom directive in Vue.js 2?
body: <p>I am trying to transfer a Vue 1.x custom directive to Vue 2.x and I can't find anywhere how to get my expressions again as a literal. Let's say this example is my custom directive:</p>
  
  <pre><code>&lt;div v-custom="file.txt"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>In Vue1</p>
  
   <pre class="lang-js prettyprint-override"><code>Vue.directive('custom', function () {
    console.log(this.expression)
  })
  </code></pre>
  
  <p>will return "file.txt" as a string.</p>
  
  <p>In Vue2</p>
  
  <pre class="lang-js prettyprint-override"><code>Vue.directive('custom', {
    bind: function (el, binding) {
      console.log(binding.expression)
    }
  })
  </code></pre>
  
  <p>will return </p>
  
  <blockquote>
    <p>[Vue warn]: Property or method "file" is not defined on the instance
    but referenced during render. Make sure to declare reactive data
    properties in the data option</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>[Vue warn]: Error in render function: "TypeError: Cannot read property
    'txt' of undefined"</p>
  </blockquote>
  
  <p>This means my expression in Vue2 is no longer a string, but a variable. How do I get it to return a string now?</p>