Skip to content

Instantly share code, notes, and snippets.

@kertnik05
Created July 22, 2020 06:20
Show Gist options
  • Select an option

  • Save kertnik05/3d5014d9ba23c86b5b46c681f4b6b484 to your computer and use it in GitHub Desktop.

Select an option

Save kertnik05/3d5014d9ba23c86b5b46c681f4b6b484 to your computer and use it in GitHub Desktop.
Vue Coding Challenge 2 Answer
//Add a link to your data object, and use
// v-bind to sync it up with an anchor tag in
// your HTML. Hint: you’ll be binding to the
// href attribute.
const app = new Vue({
el: '#app',
data: {
product: 'Socks',
description: 'A pair of warm, fuzzy socks',
image: './assets/vmSocks-green-onWhite.jpg',
link: 'somewebsite.com', // my answer to the coding challenge
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue Tuts</title>
<link rel="stylesheet" href="./style.css">
<style>
</style>
</head>
<body>
<div class="nav-bar"></div>
<div id="app">
<div class="product">
<div class="product-image">
<img :src="image" alt="">
</div>
<div class="product-info">
<h1>{{ product }}</h1>
<a :href="link" target="_blank">More products like this</a><!-- my answer to the coding challenge -->
</div>
</div>
<p>{{ description }}</p>
</div>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment