如何将Vue2.0中公共JS的抽取问题转化为高效的长尾关键词策略?
- 内容介绍
- 文章标签
- 相关推荐
本文共计439个文字,预计阅读时间需要2分钟。
首先创建一个名为 `utils.js` 的 JavaScript 文件,并包含以下内容:
javascriptexport default { install(Vue, options) { Vue.prototype.formatDuring=function(mss) { var days=parseInt(mss / (1000 * 60 * 60 * 24)); var hours=parseInt((mss / (1000 * 60 * 60)) % 24); // 其他代码... } }}
然后在你的 Vue 应用中引入并使用这个工具:
javascriptimport Vue from 'vue';import utils from './static/utils.js';
Vue.use(utils);
这样,你就可以在 Vue 组件中使用 `this.formatDuring()` 方法来格式化时间差了。
本文共计439个文字,预计阅读时间需要2分钟。
首先创建一个名为 `utils.js` 的 JavaScript 文件,并包含以下内容:
javascriptexport default { install(Vue, options) { Vue.prototype.formatDuring=function(mss) { var days=parseInt(mss / (1000 * 60 * 60 * 24)); var hours=parseInt((mss / (1000 * 60 * 60)) % 24); // 其他代码... } }}
然后在你的 Vue 应用中引入并使用这个工具:
javascriptimport Vue from 'vue';import utils from './static/utils.js';
Vue.use(utils);
这样,你就可以在 Vue 组件中使用 `this.formatDuring()` 方法来格式化时间差了。

