我正在将TS集成到使用Vue和JS的rails应用程序中。但是,在JS中编码的组件在TS中的新组件中未知。指令与其余指令相同。
我在webpack中使用rails。我已经创建了tsconfing.json,如下所示:
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowJs": true,
"lib": ["es6", "dom", "es5", "es2015", "es2018"],
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"target": "es2018",
"strict": true,
"strictNullChecks":false,
},
"include": [
"app/javascript/packs/app.ts",
],
"exclude": [
"node_modules",
],
"compileOnSave": false
}
app.ts具有扩展Vue的类:
import Vue from 'vue';
import Component from 'vue-class-component';
...
@Component
export default class VueApp extends Vue {
...
}
我将此类导入.vue
文件中,并从中继承新的类。
它非常适合我们在TS中编码的组件。但是,我们不能使用旧版组件(在JS中)。
错误:
[Vue warn]: Unknown custom element: <upload-input> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
你能帮我我所缺少的吗?