Skip to content

Instantly share code, notes, and snippets.

@patrick-steele-idem
Last active May 10, 2021 03:52
Show Gist options
  • Select an option

  • Save patrick-steele-idem/cd291a2c21ba7ea2a7e12a06467249e5 to your computer and use it in GitHub Desktop.

Select an option

Save patrick-steele-idem/cd291a2c21ba7ea2a7e12a06467249e5 to your computer and use it in GitHub Desktop.

Revisions

  1. patrick-steele-idem revised this gist Sep 17, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -74,7 +74,7 @@ __Marko:__
    __Vue:__

    ```html
    <div class=my-class" :class="{ active: isActive }" :style="{ backgroundColor: color }">
    <div :class="{ "my-class": true, active: isActive }" :style="{ backgroundColor: color }">
    ```

    ## Single file components
  2. patrick-steele-idem revised this gist Sep 17, 2017. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -137,4 +137,18 @@ module.exports = {
    </button>
    </div>
    </template>
    ```
    ```
    ## Embedded JavaScript statements
    __Marko:__
    ```marko
    $ let name = `${input.firstName} ${input.lastName}`
    <div>Hello ${name}</div>
    ```
    __Vue:__
    (not supported)
  3. patrick-steele-idem revised this gist Sep 17, 2017. 1 changed file with 12 additions and 10 deletions.
    22 changes: 12 additions & 10 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    # Custom tags and passing data
    # Syntax: Marko vs Vue

    ## Custom tags and passing data

    __Marko:__

    @@ -12,15 +14,15 @@ __Marko:__

    __Vue:__

    ```marko
    ```html
    <greeting
    :name="fullName"
    :message-count="30"
    :visible="true"
    title="Welcome"/>
    ```

    # Conditionals
    ## Conditionals

    __Marko:__

    @@ -40,13 +42,13 @@ __Marko:__

    __Vue:__

    ```vue
    ```html
    <div v-if="someCondition">
    Hello
    </div>
    ```

    # Looping
    ## Looping

    __Marko:__

    @@ -56,11 +58,11 @@ __Marko:__

    __Vue:__

    ```marko
    ```html
    <li v-for="todo in todos">
    ```

    # Class and style binding
    ## Class and style binding

    __Marko:__

    @@ -71,11 +73,11 @@ __Marko:__

    __Vue:__

    ```marko
    ```html
    <div class=my-class" :class="{ active: isActive }" :style="{ backgroundColor: color }">
    ```
    # Single file components
    ## Single file components
    __Marko:__
    @@ -107,7 +109,7 @@ style {
    __Vue:__
    ```vue
    ```html
    <script>
    module.exports = {
    data: function () {
  4. patrick-steele-idem created this gist Sep 17, 2017.
    138 changes: 138 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,138 @@
    # Custom tags and passing data

    __Marko:__

    ```marko
    <greeting
    name=fullName
    message-count=30
    visible
    title="Welcome"/>
    ```

    __Vue:__

    ```marko
    <greeting
    :name="fullName"
    :message-count="30"
    :visible="true"
    title="Welcome"/>
    ```

    # Conditionals

    __Marko:__

    ```marko
    <div if(someCondition)>
    Hello
    </div>
    // OR:
    <if(someCondition)>
    <div>
    Hello
    </div>
    </if>
    ```

    __Vue:__

    ```vue
    <div v-if="someCondition">
    Hello
    </div>
    ```

    # Looping

    __Marko:__

    ```marko
    <li for(todo in todos)>
    ```

    __Vue:__

    ```marko
    <li v-for="todo in todos">
    ```

    # Class and style binding

    __Marko:__

    ```marko
    <div.my-class class={ active: isActive } style={ backgroundColor: color }>
    ```


    __Vue:__

    ```marko
    <div class=my-class" :class="{ active: isActive }" :style="{ backgroundColor: color }">
    ```

    # Single file components

    __Marko:__

    ```marko
    class {
    onCreate() {
    this.state = {
    count: 0
    };
    }
    increment() {
    this.state.count++;
    }
    }
    style {
    .count {
    color:#09c;
    }
    }
    <div>
    <div.count>${state.count}</div>
    <button on-click('increment')>
    Click me!
    </button>
    </div>
    ```

    __Vue:__

    ```vue
    <script>
    module.exports = {
    data: function () {
    return {
    count: 0
    };
    }
    increment() {
    this.count++;
    }
    }
    </script>
    <style>
    .count {
    color:#09c;
    }
    </style>
    <template>
    <div>
    <div class="count">{{state.count}}</div>
    <button v-on:click="increment">
    Click me!
    </button>
    </div>
    </template>
    ```