-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathHelloWorld.vue
58 lines (55 loc) · 1.07 KB
/
HelloWorld.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
<template>
<div class="hello">
<h1>MY NAME IS {{ name }}</h1>
<router-link to="/test">run</router-link>
</div>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import { testRequest } from '../api/test';
export default {
name: 'HelloWorld',
data () {
return {
};
},
created () {
console.log(this.name);
this.$store.commit('CHANGE_NAME');
console.log(this.name);
},
computed: {
...mapState([
'name', // this.$store.name 映射 this.name
'userInfo'
]),
...mapGetters([
'sex'
])
},
methods: {
axiosTest () {
testRequest('crm_access_type1').then(response => {
console.log(JSON.stringify(response));
});
}
}
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>