- index.html引入:
<script src="https://cdn.bootcss.com/moment.js/2.20.1/moment.min.js"></script>
<script src="https://cdn.bootcss.com/moment.js/2.20.1/locale/zh-cn.js"></script>
- vue.config.js配置:
module.exports = {
configureWebpack: {
externals: {
"moment": "moment",
}
}
};
- .ts中使用
import moment from "moment";
@Component({})
export default class Tasks extends Vue {
time = moment();
}
网友评论