nuxt + typescript 数据结构

224 阅读1分钟
<template>
  <div class>模板</div>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from 'nuxt-property-decorator'
import { namespace } from 'vuex-class'
const userInfoNameSpace = namespace('userStore')

//components
@Component({
  layout: 'default',
  components: {}
})

export default class Index extends Vue {
  private isPrint: boolean = false
  @userInfoNameSpace.State((state) => state.userInfo)
  private userInfo: any

  @userInfoNameSpace.Mutation('setUserInfo')
  setUserInfo: any

  async asyncData ({ app, isDev, route, store, env, params, query, req, res, redirect, error, $axios }) {

  }
  fetch ({ app, isDev, route, store, env, params, query, req, res, redirect, error, $axios }) {

  }

//computed
  get userInfos() {
    return '123'
  }
  
//methods
  getList(){}
  
  
//props
  @Prop()
  private activesCommonList: any

//watch
  @Watch('activesCommonList')
  private ChangeActivesCommonList(newVal: any) {}
}
</script>

<style scoped lang="scss"></style>