s11 assignment

This commit is contained in:
Tyrel Souza 2018-04-19 00:53:16 -04:00
parent 4426f735f8
commit ef4b9c4d20
10 changed files with 7034 additions and 0 deletions

5
s11assignment/.babelrc Normal file
View File

@ -0,0 +1,5 @@
{
"presets": [
["es2015", { "modules": false }]
]
}

18
s11assignment/README.md Normal file
View File

@ -0,0 +1,18 @@
# vue-cli
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
```
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).

13
s11assignment/index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue Forms</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div id="app">
</div>
<script src="/dist/build.js"></script>
</body>
</html>

6772
s11assignment/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
{
"name": "vue-cli",
"description": "A Vue.js project",
"author": "Maximilian Schwarzmüller <mblacky0@gmail.com>",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"bootstrap": "^3.3.7",
"vue": "^2.0.1"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^9.7.0",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.0"
}
}

80
s11assignment/src/App.vue Normal file
View File

@ -0,0 +1,80 @@
<template>
<div class="container">
<form>
<div class="row" v-if="!submitted">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<full-name v-model="fullName"></full-name>
<div class="form-group">
<label for="email">Mail</label>
<input
v-model.lazy="mail"
type="text"
id="mail"
class="form-control">
</div>
<div class="form-group">
<label for="email">Password</label>
<input
v-model.lazy="password"
type="password"
id="password"
class="form-control">
</div>
<label for="storeData">
<input
v-model="storeData"
type="checkbox"
id="storeData"
value="Store"> Store
</label>
<button @click.prevent="submitted = true" class='btn btn-submit'>Submit</button>
<!-- Exercise 3 -->
<!-- Edit the Example from above and create a custom "Full Name" Control -->
<!-- which still holds the First Name and Last Name Input Field -->
</div>
</div>
</form>
<hr>
<div class="row" v-if="submitted">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Your Data</h4>
</div>
<div class="panel-body">
<p>Full Name: {{fullName}}</p>
<p>Mail: {{mail}}</p>
<p>Password: {{password}}</p>
<p>Store in Database?: {{storeData}}</p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import FullName from "./components/FullName.vue"
export default {
data() {
return {
submitted: false,
firstName:'',
lastName: '',
fullName: '',
mail: '',
password:'',
storeData: false,
};
},
components:{
fullName: FullName
}
}
</script>
<style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,50 @@
<template>
<div>
<div class="form-group">
<label for="email">First Name</label>
<input
:value="firstName"
type="text"
id="firstName"
class="form-control"
@input="nameChanged(true, $event)"
>
</div>
<div class="form-group">
<label for="email">Last Name</label>
<input
:value="lastName"
type="text"
id="lastName"
@input="nameChanged(false, $event)"
class="form-control">
</div>
</div>
</template>
<script>
export default {
props: ['value'],
computed: {
firstName(){
return this.value.split(" ")[0];
},
lastName(){
return this.value.split(" ")[1];
}
},
methods: {
nameChanged(isFirst, event) {
let name = '';
if (isFirst){
name = event.target.value + " " + this.lastName;
} else {
name = this.firstName + " " + event.target.value;
}
this.value = name;
this.$emit('input', this.value)
}
}
}
</script>

View File

@ -0,0 +1,7 @@
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: h => h(App)
})

View File

@ -0,0 +1,64 @@
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue',
options: {
// vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}