账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Vue + typescript + vuex 的代码提示问题
    43
    0

    Vue.extend 的方式,在 computed 中使用 vuex 的 mapGetters,this 上无相关属性的代码提示,使用 this.userinfo 会报错
    (之前想着如果使用ts出问题可以快速回退,所以没有用class和装饰器,所以我想在 Vue.extend 下解决这个问题)
    (其实报错的问题已经解决了,目前是想要 mapGetters 引入的属性的代码提示)

    <script lang="ts">
    
    import { mapGetters } from 'vuex'
    
    export default Vue.extend({
        computed: {
            ...mapGetters(['userinfo'])
        },
        methods: {
            test () {
                // 如何让这个 userinfo 有提示
                this.userinfo
            }
        }
    })
    
    </script>
    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 10 元积分
        全部回答
    • 0
    • 秋ㄨ落尽 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部