Pen Settings

HTML

CSS

CSS Base

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

Vue

              
                <template>
  <div id="app">
    <div class='card'>
        <!-- Show the count -->
        <h1>{{ count }}</h1>
    </div>
      
      <!-- If the count is done, show message and reset button -->
      <div v-if="count === 0">
          <h3>{{ message }}</h3>
          
          <!-- Button has an @click listener to restart the countdown -->
          <button @click="startCountdown">Restart the Clock</button>
    </div>
      <div v-else>
          <h3>Counting...</h3>
    </div>
  </div>
</template>

<script>
export default {
    props: {
        start: {
            type: Number,
            default: 10,
            required: false
        }
    },
  data() {
    return {
      count: 10,
        message: "And we're done!",
        timer: null // Tracks the setInterval timer
    };
  },
  mounted(){
        // When the Vue component mounts, start the countdown
        this.startCountdown()
    },
  methods: {
      
      // Handler within setInterval
    countDown(){
         if(this.count === 0){
             clearInterval(this.timer)
         }
         else {
             this.count--
         }
    },
     startCountdown(){
         this.count = this.start // 
         this.timer = setInterval(this.countDown, 500)
     }
  }
};
</script>

<!-- Use preprocessors via the lang attribute! e.g. <style lang="scss"> -->
<style lang="scss">
    @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;900&display=swap');
    :root {
        --color-text: #2c3e50;
        --color-primary: #0496ff;
        --body-background: #f9f9f9;
    }
    
#app {
    background: var(--body-background);
    font-family: 'Poppins', Avenir, Helvetica, Arial, sans-serif;
    text-align: center;
    color: var(--color-text);
    padding-top: 60px;
    height: 100vh;
    width: 100vw;
}
    
    .card {
        box-shadow: rgba(17, 17, 26, 0.05) 0px 4px 16px, rgba(17, 17, 26, 0.05) 0px 8px 32px;
        border-radius: 25px;
        display: inline-flex;
        margin: 0 auto 45px;
        padding: 60px 60px;
        height: 300px;
        width: 300px;
        align-items: center;
        justify-content: center;
    }

    h1 {
        font-size: 4rem;
    }
    
    h3 {
        letter-spacing: 1px;
        text-transform: uppercase;
    }

button {
    color: var(--color-primary);
    background: none;
    border: solid 1px;
    border-radius: 2em;
    font: inherit;
    padding: 0.75em 2em;
    
    &:hover,
    &:focus {
        background: var(--color-primary);
        color: #fff;
        cursor: pointer;
    }
}
</style>
              
            
!
999px

Console