Commit 8cb9a466 authored by W.H.M Kasun Sampath's avatar W.H.M Kasun Sampath

Pushing vuejs test project

parent 1847a617
Pipeline #5385 failed with stages
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# VueJs Test # image
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "image",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"bootstrap": "^4.0.0-beta",
"core-js": "^3.8.3",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"vue": "^2.6.14"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"vue-template-compiler": "^2.6.14"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<!-- 1.Display some data in a variable using the double curly braces or mistache tag {{}}. -->
<div> <h3 class="p-3 text-center"> {{ "I'm New to VueJs" }}</h3></div>
<!-- 2.a. Place an image using the img tag. -->
<img src="../assets/intro.jpeg" alt="intro" width="500" height="200">
<!-- 2.b. Place a button tag next to it. When pressed, toggle the display and hiding of the image using v-if. -->
<button v-on:click="isHidden = !isHidden">Toggle hide and show</button>
<h1 v-if="!isHidden"></h1>
<!-- 3.Create a small array and put some data in it (any data). In Vue try to iterate through the data and display the data in HTML using v-for. -->
<div class="container">
<h3 class="p-3 text-center">Display a list of names with v-for</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Province</th>
</tr>
</thead>
<tbody>
<tr v-for="user in users" :key="user.id">
<td>{{user.firstName}} {{user.lastName}}</td>
<td>{{user.email}}</td>
<td>{{user.province}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script>
export default {
data() {
return {
users: [
{ firstName: 'Kasun', lastName: 'Sampath', email: 'kasunsampath@test.com', province: 'Western' },
{ firstName: 'Dasun', lastName: 'Sameera', email: 'dasun.abc@test.com', province: 'North' },
{ firstName: 'Gina', lastName: 'Rathnayake', email: 'ginarathnayake@test.com', province: 'Uwa' },
{ firstName: 'Jessi', lastName: 'Glaser', email: 'jessi.glaser@test.com', province: 'Sabaragamuwa' },
{ firstName: 'Jay', lastName: 'Bilzerian', email: 'jay.bilzerian@test.com', province: 'Southern' }
]
};
}
};
// 4.Create an object with several fields and values and attempt to iterate through it and display the data using the Iterate Through Object Properties technique.
const user = {
name: 'Kasun Sampath',
email: 'kasunsampath@test.com',
age: 24,
dob: '05/04/1997',
active: true
};
// iterate over the user object
for (const key in user) {
console.log(`${key}: ${user[key]}`);
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
@import'~bootstrap/dist/css/bootstrap.css'
</style>
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment