|
|
@@ -5,37 +5,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// 请求接口
|
|
|
-import { getUserInfo } from '@/api/login.js'
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
+import TopBar from '@/components/TopBar'
|
|
|
export default {
|
|
|
+ components: { TopBar },
|
|
|
data() {
|
|
|
return {
|
|
|
- wechat: `${this.$cdn}/wx/640.gif`
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapGetters(['userName'])
|
|
|
- },
|
|
|
mounted() {
|
|
|
- this.initData()
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
- // 请求数据案例
|
|
|
- initData() {
|
|
|
- // 请求接口数据,仅作为展示,需要配置src->config下环境文件
|
|
|
- const params = { user: 'sunnie' }
|
|
|
- getUserInfo(params)
|
|
|
- .then(() => {})
|
|
|
- .catch(() => {})
|
|
|
- },
|
|
|
- // Action 通过 store.dispatch 方法触发
|
|
|
- doDispatch() {
|
|
|
- this.$store.dispatch('setUserName', '真乖,赶紧关注公众号,组织都在等你~')
|
|
|
- },
|
|
|
- goGithub() {
|
|
|
- window.location.href = 'https://github.com/sunniejs/vue-h5-template'
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|