Skip to content

Commit 6004f49

Browse files
committed
add demos:
* [表单输入绑定的值绑定](samples/form-input-binding-value-binding) * [表单输入绑定的修饰符](samples/form-input-binding-modifier)
1 parent 9c1c939 commit 6004f49

21 files changed

+59062
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
* [事件](samples/event-basic)
5050
* [多事件处理器](samples/event-muti)
5151
* [表单输入绑定的基础用法](samples/form-input-binding)
52+
* [表单输入绑定的值绑定](samples/form-input-binding-value-binding)
53+
* [表单输入绑定的修饰符](samples/form-input-binding-modifier)
5254
* 未完待续...
5355

5456

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# form-input-binding-modifier
2+
3+
## Project setup
4+
```
5+
npm install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
npm run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
npm run build
16+
```
17+
18+
### Lints and fixes files
19+
```
20+
npm run lint
21+
```
22+
23+
### Customize configuration
24+
See [Configuration Reference](https://cli.vuejs.org/config/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

samples/form-input-binding-modifier/package-lock.json

+29,317
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "form-input-binding-modifier",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"core-js": "^3.6.5",
12+
"vue": "^3.0.0",
13+
"vue-class-component": "^8.0.0-0"
14+
},
15+
"devDependencies": {
16+
"@typescript-eslint/eslint-plugin": "^4.18.0",
17+
"@typescript-eslint/parser": "^4.18.0",
18+
"@vue/cli-plugin-babel": "~4.5.0",
19+
"@vue/cli-plugin-eslint": "~4.5.0",
20+
"@vue/cli-plugin-typescript": "~4.5.0",
21+
"@vue/cli-service": "~4.5.0",
22+
"@vue/compiler-sfc": "^3.0.0",
23+
"@vue/eslint-config-typescript": "^7.0.0",
24+
"babel-eslint": "^10.1.0",
25+
"eslint": "^6.7.2",
26+
"eslint-plugin-vue": "^7.0.0",
27+
"typescript": "~4.1.5"
28+
},
29+
"eslintConfig": {
30+
"root": true,
31+
"env": {
32+
"node": true
33+
},
34+
"extends": [
35+
"plugin:vue/vue3-essential",
36+
"eslint:recommended",
37+
"@vue/typescript"
38+
],
39+
"parserOptions": {
40+
"parser": "@typescript-eslint/parser"
41+
},
42+
"rules": {}
43+
},
44+
"browserslist": [
45+
"> 1%",
46+
"last 2 versions",
47+
"not dead"
48+
]
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<!-- .lazy修饰符,change事件之后再进行同步 -->
3+
<div>
4+
<input v-model.lazy="message" />
5+
<p>输入的消息: {{ message }}</p>
6+
</div>
7+
8+
<!-- .number修饰符,自动将用户的输入值转为数值类型 -->
9+
<div>
10+
<input v-model.number="age" />
11+
<p>输入的内容: {{ age }}</p>
12+
</div>
13+
14+
<!-- .trim修饰符,自动将用户的输入值转为数值类型 -->
15+
<div>
16+
<input v-model.trim="text" />
17+
<p>输入的内容: {{ text }}</p>
18+
</div>
19+
</template>
20+
21+
<script lang="ts">
22+
import { Vue } from "vue-class-component";
23+
24+
export default class App extends Vue {
25+
private message: string = "";
26+
27+
private age: number = 0;
28+
29+
private text: string = "";
30+
}
31+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp(App).mount('#app')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint-disable */
2+
declare module '*.vue' {
3+
import type { DefineComponent } from 'vue'
4+
const component: DefineComponent<{}, {}, any>
5+
export default component
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"strict": true,
6+
"jsx": "preserve",
7+
"importHelpers": true,
8+
"moduleResolution": "node",
9+
"experimentalDecorators": true,
10+
"allowJs": true,
11+
"skipLibCheck": true,
12+
"esModuleInterop": true,
13+
"allowSyntheticDefaultImports": true,
14+
"sourceMap": true,
15+
"baseUrl": ".",
16+
"types": [
17+
"webpack-env"
18+
],
19+
"paths": {
20+
"@/*": [
21+
"src/*"
22+
]
23+
},
24+
"lib": [
25+
"esnext",
26+
"dom",
27+
"dom.iterable",
28+
"scripthost"
29+
]
30+
},
31+
"include": [
32+
"src/**/*.ts",
33+
"src/**/*.tsx",
34+
"src/**/*.vue",
35+
"tests/**/*.ts",
36+
"tests/**/*.tsx"
37+
],
38+
"exclude": [
39+
"node_modules"
40+
]
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# form-input-binding-value-binding
2+
3+
## Project setup
4+
```
5+
npm install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
npm run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
npm run build
16+
```
17+
18+
### Lints and fixes files
19+
```
20+
npm run lint
21+
```
22+
23+
### Customize configuration
24+
See [Configuration Reference](https://cli.vuejs.org/config/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

0 commit comments

Comments
 (0)