Vue&;TypeScript如何在render中获取数据属性?

Vue&;TypeScript如何在render中获取数据属性?,typescript,vue.js,Typescript,Vue.js,当我使用TypeScript时,我试图在render中使用它。 但它不能运行: TS2339:类型上不存在属性“选项” '组件选项,默认方法, DefaultComputed,PropsDefinition 从“Vue”导入Vue 声明模块“vue/types/vue”{ 接口Vue{ OnSwich:函数 } } 导出默认Vue.extend({ 名称:'footerTabs', 数据(){ 返回{ 选项:{ 关于:{ 单击:el=>this.onSwtich(el) } } } }, 渲染(

当我使用TypeScript时,我试图在render中使用它。 但它不能运行:

TS2339:类型上不存在属性“选项” '组件选项,默认方法, DefaultComputed,PropsDefinition
从“Vue”导入Vue
声明模块“vue/types/vue”{
接口Vue{
OnSwich:函数
}
}
导出默认Vue.extend({
名称:'footerTabs',
数据(){
返回{
选项:{
关于:{
单击:el=>this.onSwtich(el)
}
}
}
},
渲染(h){
返回h('swiper'{
类:“页脚选项卡”,
属性:{
选项:this.options//TS2339:类型“ComponentOptions
声明模块“vue/types/options”上不存在属性“options”{
接口组件选项{
选项?:有吗
}
}
事实证明,它需要这样声明

import Vue from 'vue'

declare module 'vue/types/vue' {
    interface Vue {
        onSwtich: Function
    }
}

export default Vue.extend({
    name: 'footerTabs',
    data() {
        return {
            options: {
                on: {
                    click: el => this.onSwtich(el)
                }
            }
        }
    },
    render(h) {
        return h('swiper', {
            class: 'page-footer-tabs',
            attrs: {
                options: this.options  // TS2339: Property 'options' does not exist on type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Rec...'.
            }
        })
    },
    methods: {
        onSwtich(el): void {
            this.$emit('on-switch', el)
        }
    }
})
declare module 'vue/types/options' {
    interface ComponentOptions<V extends Vue> {
        options?: any
    }
}