TS中+独立的html并在里面使用{{$route.params}}提示You may need an appropriate loader to handle this file type
发布于 3 年前 作者 clubadmin 1279 次浏览 来自 问答
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利

求解决。。

test2.html

<div>
    <p>test2</p>
    {{$route.params}}
</div>

# test2.ts
import {Component, Prop, Vue} from 'vue-property-decorator';

@Component({
    template: require('./test2.html'),
})
export default class Test2 extends Vue {
}

错误信息

Failed to compile.

./src/views/test2.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> <div>
|     <p>test2</p>
|     {{$route.params}}

链接: https://pan.baidu.com/s/1Gk0IWDdEN41MA7fy_diAOw 提取码: pnig 复制这段内容后打开百度网盘手机App,操作更方便哦

回到顶部