A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/releases/tag/1.0.0 below:

Release 1.0.0 Evangelion · vuejs/vue · GitHub

"The fate of destruction is also the joy of rebirth." - SEELE

About the Release

Please read the blog post.

Known Issues Upgrade Guide General Tips Notable Changes Full Changelog (from 0.12.16) Template Syntax Changes
  1. Directive Arguments

    The concept of multiple clauses (multiple directives separated by comma in the same attribute) is deprecated, and directive arguments are moved into the attribute name:

    <!-- before: -->
    <div v-dirname="arg1: expression1, arg2: expression2">
    
    <!-- after: -->
    <div
      v-dirname:arg1="expression1"
      v-dirname:arg2="expression2">

    Using real directives as example:

    <!-- before: -->
    <div v-on="click: doThis, keyup: doThat">
    
    <!-- after: -->
    <div
      v-on:click="doThis"
      v-on:keyup="doThat">
  2. Literal Directives

    There is no longer "literal directives" from the implementation perspective. All directives are reactive by default, which makes it easy to know whether an attribute value is an expression or a literal string. If you wish to pass the directive a literal string, use the following syntax:

    <!-- before: no way to tell if this is a string or an expression! -->
    <div v-dirname="abc">
    
    <!-- after: explicitly denoting a literal string -->
    <div v-dirname.literal="abc">

    The ending .literal is called a Binding Modifier, which forces the directive to be bound in literal mode. We will see this concept used below for prop binding types as well. In literal mode, the directive's update function will be called once, with the literal string as the argument.

  3. Attribute Bindings

    Mustache tags can only appear inside native attributes. To dynamically bind a custom attribute or a prop, use the v-bind directive (which replaces v-attr):

    <!-- this is valid -->
    <a href="{{baseURL}}/abc"></a>
    
    <!-- these are no longer valid -->
    <component is="{{view}}"></component>
    <partial name="{{partialName}}"></partial>
    
    <!-- use v-bind for non-native attributes -->
    <component v-bind:is="view"></component>
    <partial v-bind:name="partialName"></partial>

    Vue will raise a warning whenever mustaches are used in non-native attributes.

  4. Props

    Previously props use mustaches to indicate reactivity. Now they must use v-bind:

    <!-- before -->
    <my-comp
      prop="a literal string"
      prop="{{expression}}">
    <my-comp>
    
    <my-comp
      prop="a literal string"
      v-bind:prop="expression">
    </my-comp>

    Binding type indicators (@ and *) are now replaced by more explicit binding modifiers:

    <!-- before -->
    <my-comp
      prop="{{defaultOneWay}}"
      prop="{{@twoWay}}"
      prop="{{*oneTime}}">
    </my-comp>
    
    <!-- after -->
    <my-comp
      v-bind:prop="defaultOneWay"
      v-bind:prop.sync="twoWay"
      v-bind:prop.once="oneTime">
    </my-comp>
  5. Shorthands

    You may have noticed we will be using v-bind and v-on quite a lot. 1.0 will provide optional shorthand syntax for these two directives. v-bind: can be shortened to a single colon :, while v-on: can be shortened to a single @ symbol:

    <!-- attribute binding -->
    <img :src="imgSrc">
    
    <!-- event handlers -->
    <input @click="handleClick" @keyup="handleKeyup">
    
    <!-- props -->
    <my-comp
      :prop="expression"
      :prop.sync="twoWay"
      :prop.once="oneTime">
    </my-comp>
    
    <!-- special attributes -->
    <component :is="view"></component>
    <partial :name="partialName"></partial>

    If you are only using Vue as an enhancement on existing HTML pages, you may want to stick with the v- prefixed versions. The shorthand is designed to make the template more succinct when you are building large SPAs where Vue manages everything. Don't worry about it not looking like valid HTML - all browsers can parse it just fine, and Vue removes all the special stuff in the rendered HTML anyway.

Directive Changes Component API Changes Filter Changes General API Changes

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4