project init
This commit is contained in:
22
untils/func.js
Normal file
22
untils/func.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const windowWidth = uni.getSystemInfoSync().windowWidth
|
||||
|
||||
class func {
|
||||
/**
|
||||
* rpx转换为px
|
||||
* @param rpx
|
||||
* @returns {number}
|
||||
*/
|
||||
static rpxTopx(rpx) {
|
||||
return (windowWidth / 750) * rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
*/
|
||||
export default {
|
||||
install(Vue, options) {
|
||||
// 4. 添加实例方法
|
||||
Vue.prototype.$util = func
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user