Contents
<script lang="tsx">
import { Vue, Component, Prop } from 'vue-property-decorator';
import { ElIssueIcon } from '@/components';
@Component({
components: { ElIssueIcon }
})
export default class ElEpicTitle extends Vue {
@Prop() title!: string;
private render() {
return (
<div class='epic-container'>
<ElIssueIcon type={4} />
{this.title}
</div>
);
}
}
</script>
出现如下错误
Property 'type' does not exist on type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'
解决方法
修改shims-tsx.d.ts
文件
import Vue, { VNode } from 'vue';
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
}
// new add
interface ElementAttributesProperty {
$props: {};
}
}
}