-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
12,039 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> 1% | ||
last 2 versions | ||
not dead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# todolist | ||
|
||
## Project setup | ||
``` | ||
npm install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
``` | ||
npm run serve | ||
``` | ||
|
||
### Compiles and minifies for production | ||
``` | ||
npm run build | ||
``` | ||
|
||
### Customize configuration | ||
See [Configuration Reference](https://cli.vuejs.org/config/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "todolist", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build" | ||
}, | ||
"dependencies": { | ||
"core-js": "^3.6.5", | ||
"vue": "^3.0.0", | ||
"vue-router": "^4.0.0-0", | ||
"vuex": "^4.0.0-0" | ||
}, | ||
"devDependencies": { | ||
"@vue/cli-plugin-babel": "~4.5.0", | ||
"@vue/cli-plugin-router": "~4.5.0", | ||
"@vue/cli-plugin-vuex": "~4.5.0", | ||
"@vue/cli-service": "~4.5.0", | ||
"@vue/compiler-sfc": "^3.0.0", | ||
"sass": "^1.26.5", | ||
"sass-loader": "^8.0.2" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<router-view/> | ||
</template> | ||
|
||
<style lang="scss"> | ||
</style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<div> | ||
This is Child | ||
{{msg}} | ||
<button @click="send">传值给父组件</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {defineComponent,ref,onMounted} from 'vue' | ||
export default defineComponent({ | ||
name:'Child', | ||
props:{ | ||
msg:{ | ||
type:String | ||
} | ||
}, | ||
setup(props,ctx){ | ||
console.log(props.msg) | ||
let childMsg = ref('这是子组件的数值') | ||
let send = ()=>{ | ||
ctx.emit('childSend',childMsg.value) | ||
} | ||
onMounted(()=>{ | ||
ctx.emit('childSend',{ | ||
value1:childMsg.value, | ||
value2:childMsg.value | ||
}) | ||
}) | ||
return { | ||
childMsg, | ||
send | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<div class="container"> | ||
<div> | ||
已完成{{isCompelet}} / 全部{{list.length}} | ||
</div> | ||
<div v-if="isCompelet > 0" class="btn"> | ||
<button @click="clear"> | ||
清除已完成 | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {defineComponent,ref,computed} from 'vue' | ||
export default defineComponent({ | ||
name:'NavFooter', | ||
props:{ | ||
list:{ | ||
type:Array, | ||
required:true | ||
} | ||
}, | ||
setup(props,ctx){ | ||
let isCompelet = computed(()=>{ | ||
let arr = props.list.filter(item=>{ | ||
return item.complete | ||
}) | ||
return arr.length | ||
}) | ||
let clear = ()=>{ | ||
console.log('clear') | ||
let arr = props.list.filter(item=>{ | ||
return item.complete == false | ||
}) | ||
ctx.emit('clear',arr) | ||
} | ||
return{ | ||
isCompelet, | ||
clear | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.container{ | ||
display: flex; | ||
align-items: center; | ||
.btn{ | ||
margin-left:10px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<div> | ||
<input placeholder="请输入名称" v-model="value" @keydown.enter="enter"/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {defineComponent,ref} from 'vue' | ||
export default defineComponent({ | ||
name:'NavHeader', | ||
setup(props,ctx){ | ||
let value = ref('') | ||
let enter = () =>{ | ||
// console.log(value.value) | ||
ctx.emit('add',value.value) | ||
value.value='' | ||
} | ||
return { | ||
value, | ||
enter | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
input{ | ||
margin-bottom:10px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<div> | ||
<div v-if="list.length>0"> | ||
<div v-for="(item,index) in list" :key="index"> | ||
<div class="item"> | ||
<input type="checkbox" v-model="item.complete"> | ||
{{item.title}} | ||
<button @click="del(item,index)">删除</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div v-else> | ||
没有任务 | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { | ||
defineComponent, | ||
ref | ||
} from 'vue' | ||
export default defineComponent({ | ||
name: 'NavMain', | ||
props: { | ||
list: { | ||
type: Array, | ||
required: true | ||
} | ||
}, | ||
emits: ['delTodo'], | ||
setup(props, ctx) { | ||
let del = (item, index) => { | ||
// console.log(item,index) | ||
ctx.emit('delTodo', index) | ||
} | ||
return { | ||
del | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.item { | ||
height: 35px; | ||
line-height: 35px; | ||
width: 160px; | ||
cursor: pointer; | ||
position: relative; | ||
button { | ||
position: absolute; | ||
right: 20px; | ||
top: 6px; | ||
display: none; | ||
z-index: 99 | ||
} | ||
&:hover { | ||
background: #CCC; | ||
button { | ||
display: block; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
import store from './store' | ||
|
||
createApp(App).use(store).use(router).mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createRouter, createWebHistory } from 'vue-router' | ||
import Home from '../views/Home.vue' | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
name: 'Home', | ||
component: Home | ||
}, | ||
{ | ||
path: '/Start', | ||
name: 'Start', | ||
component: () => import('../views/Start.vue') | ||
}, | ||
{ | ||
path: '/Detail', | ||
name: 'Detail', | ||
component: () => import('../views/Detail.vue') | ||
}, | ||
{ | ||
path: '/About', | ||
name: 'About', | ||
// route level code-splitting | ||
// this generates a separate chunk (about.[hash].js) for this route | ||
// which is lazy-loaded when the route is visited. | ||
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') | ||
} | ||
] | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(process.env.BASE_URL), | ||
routes | ||
}) | ||
|
||
export default router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { createStore } from 'vuex' | ||
|
||
export default createStore({ | ||
//定义所需要的状态 | ||
state: { | ||
list : [ | ||
{ | ||
title:'吃饭', | ||
complete:false | ||
}, | ||
{ | ||
title:'睡觉', | ||
complete:false | ||
}, | ||
{ | ||
title:'打豆豆', | ||
complete:false | ||
} | ||
] | ||
}, | ||
//同步修改state,全是方法 | ||
mutations: { | ||
//添加任务 | ||
addTodo(state,payload){ | ||
state.list.push(payload) | ||
}, | ||
//删除任务 | ||
delTodo(state,payload){ | ||
state.list.splice(payload,1) | ||
}, | ||
//删除已完成 | ||
clear(state,payload){ | ||
state.list = payload | ||
} | ||
}, | ||
//异步提交mutation | ||
actions: { | ||
|
||
}, | ||
//模块化 | ||
modules: { | ||
} | ||
}) |
Oops, something went wrong.