|
本帖最后由 豆芽爸爸 于 2021-11-22 18:29 编辑
在页面export default {} 之前引入以下代码。<template></template> 和 <style></style> 里边都支持。
如你可以命名以下代码的js文件为dfn.min.js
在你的<script></script>代码中可以这样操作:
import '../script/dfn.min'
export default {
name: "main",
}
- (()=>{"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};const n=function(n){return"object"===(void 0===n?"undefined":t(n))&&null!==n},r=api.getSystemInfoSync();let e=!1,o=0,i=0;const f=/(:|\s|\b|\(|\/)[+-]?\d+(\.\d+)?rpx/g,c=function(t){if(!function(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)}(t))return t;var n=t.match(f);return n&&n.forEach((function(n){var f=n.match(/[+-]?\d+(\.\d+)?/g),c=function(t,n){if(0===o&&(o=api.winWidth,i=r.pixelRatio,e="ios"===api.systemType),0===(t=Number(t)))return 0;let f=n||o;f=750===t||f<=960?f:375;let c=t/750*f;return c<0&&(c=-c),c=Math.floor(c+1e-4),0===c&&(c=1!==i&&e?.5:1),t<0?-c:c}(f[0]);t=t.replace(f[0]+"rpx",c+"px")})),t};var u=apivm.define,p=apivm.h;apivm.h=(t,n,...r)=>(n&&n.style&&(n.style=c(n.style)),p(t,n,...r)),apivm.define=function(t,r){r.css=function(t){if(!n(t))return{};for(var r in t){var e=t[r];if(n(e)){for(var o in e)e[o].indexOf("rpx")>0&&(e[o]=c(e[o]));t[r]=e}}return t}(r.css),u(t,r)}})();
复制代码
|
|