【问题标题】:how to hot reload component with ts and vue-property-decorator如何使用 ts 和 vue-property-decorator 热重载组件
【发布时间】:2018-02-20 18:03:39
【问题描述】:
我在 .ts 文件上更改的每个代码都会触发浏览器刷新,我不希望它以这种方式工作。我尝试了很多解决方案,例如“vue-ts-loader”、“vue-hot-reload-api”、...,但我没有找到一个好的解决方案。你们是如何解决这个问题的?
【问题讨论】:
标签:
typescript
vue.js
vue-component
【解决方案1】:
就像 Suresh Velusamy 说的:试试 github.com/ducksoupdev/vue-webpack-typescript 。
它开箱即用。
不需要模板文件,只需将模板内联即可。工作正常。
@Component({
template: `<div class="container content">
<div class="row">
<div class="content col-md-4">
<h1>
<strong>Thank you the fish
<span class="text-primary package">{{package}}</span>
</strong>
</h1>
<p>This project is running in
<strong class="mode">{{mode}} mode</strong>
</p>
<p>Make sure to follow the project on
<a :href="repo">GitHub</a> to stay up to date with the latest releases,
or contribute to the project by opening an issue
or making a pull-request!</p>
</div>
</div>
</div>`})