-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVueDemo.vue
160 lines (127 loc) · 2.63 KB
/
VueDemo.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<template>
<div>
<TestDemo
:is=""
v-for=""
v-if=""
v-else-if=""
v-else=""
v-show=""
v-cloak=""
v-pre=""
v-once=""
id=""
ref=""
key=""
slot=""
v-model=""
v-on=""
v-html=""
v-text=""
>
{{ test }}
</TestDemo>
</div>
</template>
<script type="text/babel">
import { mapGetters, mapActions } from 'vuex';
/**
* ----------------------------------------------------------------------------------
* VueDemo Component
* ----------------------------------------------------------------------------------
*
* @link https://cn.vuejs.org/v2/api
* @link https://cn.vuejs.org/v2/style-guide/index.html#%E4%BC%98%E5%85%88%E7%BA%A7-C-%E7%9A%84%E8%A7%84%E5%88%99%EF%BC%9A%E6%8E%A8%E8%8D%90-%E5%B0%86%E9%80%89%E6%8B%A9%E5%92%8C%E8%AE%A4%E7%9F%A5%E6%88%90%E6%9C%AC%E6%9C%80%E5%B0%8F%E5%8C%96
* @author lanlin
* @change 2018/12/07
*/
export default {
el: null,
name: 'VueDemo',
parent: null,
functional: false,
delimiters: ['${', '}'],
comments: false,
components: {},
directives: {},
filters: {},
extends: null,
mixins: [],
inheritAttrs: true,
model: {
prop: 'checked',
event: 'change',
},
props: {
// 将 value 属性用作其他目的
value: {
type: String,
default: null,
},
// 用 checked 替代 value 的位置
checked: {
type: Number,
default: 0,
},
age: {
type: Number,
default: 0,
required: true,
validator(value) { return value >= 0; },
},
},
propsData: {},
data() {
return {
test: '',
};
},
computed: {
...mapGetters([
// ...
]),
// 仅读取
aDouble() { return this.a * 2; },
// 读取和设置
aPlus: {
get() { return this.a + 1; },
set(v) { this.a = v - 1; },
},
},
watch: {},
beforeCreate() {},
created() {},
beforeMount() {},
mounted() {},
beforeUpdate() {},
updated() {},
activated() {},
deactivated() {},
beforeDestroy() {},
destroyed() {},
methods: {
// ------------------------------------------------------------------------------
// map action methods
...mapActions([
// ...
]),
// ------------------------------------------------------------------------------
testing() {
// ...
},
// ------------------------------------------------------------------------------
},
template: '',
render(h) {
return h(
// ...
);
},
renderError(h, err) {
return h('pre', { style: { color: 'red' } }, err.stack);
},
};
</script>
<style lang="less">
@import '~src/assets/style/component.less';
</style>