TypeScript 快速开始 mpvue 开发指南
使用 TypeScript 快速开始 mpvue 开发
档提供了一个使用 TypeScript 快速开始 mpvue 开发的指南。
安装
$ npm install -g vue-cli
$ vue init zacksleo/mpvue-quickstart-ts my-project
$ cd my-project
$ npm install
$ npm run dev
特性
- 使用 axios 作为 HTTP 请求库,兼容小程序和 Web
- TSLint 格式检查
- vuex 配置
- 可选的小程序 API,TypeScript 验证和提示支持
注意事项
- 如果页面中未使用组件,仍需要使用
@Component
装饰器进行装饰,例如:
@Component
class Index extends Vue {
// ...
}
- 组件 Prop
@Component
export default class MyComponent extends Vue {
@Prop({ default: 'world' })
private msg!: string;
}
38.32KB
文件大小:
评论区