当前位置: 首页 > news >正文

网站 主营业务怎么搭建属于自己的网站

网站 主营业务,怎么搭建属于自己的网站,聊城网站建设哪家专业,直接用ip做网站背景说明 如果你的 Ant Design Vue 项目有要做适配的需求,那首先要选择一种适配方案。笔者选择的是用 postcss-px2rem 进行适配。笔者在配置了 postcss-px2rem的相关配置后,发现 postcss-px2rem 没有对 Ant Design Vue 进行适配。在网上看了一些文章之后…

背景说明

如果你的 Ant Design Vue 项目有要做适配的需求,那首先要选择一种适配方案。笔者选择的是用 postcss-px2rem 进行适配。笔者在配置了 postcss-px2rem的相关配置后,发现 postcss-px2rem 没有对 Ant Design Vue 进行适配。在网上看了一些文章之后,发现想对 Ant Design Vue 进行适配需要走它自己的规则:给 a-style-provider 组件传入 transformerspropsAnt Design Vue 官方自己提供了一套 transformers 方法,用这套方法可以对大于1px的单位进行转换,而不凑巧的是笔者的项目有对1px进行适配的需求,所以笔者必须解决这个问题。

解决方案

不直接用官方的方案,而是用官方方案的修改版。

编写一个px2rem的方法,然后在 a-style-provider 里引进去。

// 这应该是一个文件,例如px2Rem.ts
import unitless from '@emotion/unitless'
export interface Options {/*** The root font size.* @default 16*/rootValue?: number/*** The decimal numbers to allow the REM units to grow to.* @default 5*/precision?: number/*** Whether to allow px to be converted in media queries.* @default false*/mediaQuery?: boolean
}const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/gfunction toFixed(number: number, precision: number) {const multiplier = Math.pow(10, precision + 1),wholeNumber = Math.floor(number * multiplier)return (Math.round(wholeNumber / 10) * 10) / multiplier
}const transform = (options: Options = {}): Transformer => {const { rootValue = 16, precision = 5, mediaQuery = false } = optionsconst pxReplace = (m: string, $1: any) => {if (!$1) return mconst pixels = parseFloat($1)if (pixels < 1) return mconst fixedVal = toFixed(pixels / rootValue, precision)return `${fixedVal}rem`}const visit = (cssObj: any): any => {const clone: any = { ...cssObj }Object.entries(cssObj).forEach(([key, value]) => {if (typeof value === 'string' && value.includes('px')) {const newValue = value.replace(pxRegex, pxReplace)clone[key] = newValue}// no unitif (!unitless[key] && typeof value === 'number' && value !== 0) {clone[key] = `${value}px`.replace(pxRegex, pxReplace)}// Media queriesconst mergedKey = key.trim()if (mergedKey.startsWith('@') && mergedKey.includes('px') && mediaQuery) {const newKey = key.replace(pxRegex, pxReplace)clone[newKey] = clone[key]delete clone[key]}})return clone}return { visit } as Transformer<any, any>
}export default transform

App.vue该如下

import px2rem from "./px2Rem.ts" // 自行修改
<template><a-config-provider><a-style-provider :transformers="[px2rem]"><component /></a-style-provider></a-config-provider>
</template>

文章转载自:
http://principled.tyjp.cn
http://southeast.tyjp.cn
http://interrelation.tyjp.cn
http://cantlet.tyjp.cn
http://chechia.tyjp.cn
http://garri.tyjp.cn
http://radiophare.tyjp.cn
http://virtual.tyjp.cn
http://chemoimmunotherapy.tyjp.cn
http://peopleless.tyjp.cn
http://stainability.tyjp.cn
http://anchormanese.tyjp.cn
http://sheep.tyjp.cn
http://ipm.tyjp.cn
http://chlamydeous.tyjp.cn
http://lacunate.tyjp.cn
http://aftereffect.tyjp.cn
http://presignify.tyjp.cn
http://wow.tyjp.cn
http://rauwolfia.tyjp.cn
http://plasticity.tyjp.cn
http://quizzy.tyjp.cn
http://congruously.tyjp.cn
http://fairground.tyjp.cn
http://yeoman.tyjp.cn
http://flabellation.tyjp.cn
http://airproof.tyjp.cn
http://emulgent.tyjp.cn
http://maximality.tyjp.cn
http://ripe.tyjp.cn
http://cazique.tyjp.cn
http://proportionately.tyjp.cn
http://triquetra.tyjp.cn
http://legumen.tyjp.cn
http://curragh.tyjp.cn
http://gks.tyjp.cn
http://provenance.tyjp.cn
http://encore.tyjp.cn
http://lethargize.tyjp.cn
http://fa.tyjp.cn
http://communications.tyjp.cn
http://hypothermal.tyjp.cn
http://bok.tyjp.cn
http://pomeron.tyjp.cn
http://odontornithic.tyjp.cn
http://bolson.tyjp.cn
http://gallopade.tyjp.cn
http://flamboyancy.tyjp.cn
http://banneret.tyjp.cn
http://impression.tyjp.cn
http://lodging.tyjp.cn
http://forcipiform.tyjp.cn
http://monomoy.tyjp.cn
http://astrophotometry.tyjp.cn
http://sightsinging.tyjp.cn
http://vicarious.tyjp.cn
http://aeromotor.tyjp.cn
http://seducement.tyjp.cn
http://elysian.tyjp.cn
http://obligingly.tyjp.cn
http://volunteer.tyjp.cn
http://curator.tyjp.cn
http://cyaneous.tyjp.cn
http://poofter.tyjp.cn
http://stronghold.tyjp.cn
http://windflaw.tyjp.cn
http://diphenoxylate.tyjp.cn
http://diva.tyjp.cn
http://moravia.tyjp.cn
http://pawky.tyjp.cn
http://phytology.tyjp.cn
http://bullbat.tyjp.cn
http://driblet.tyjp.cn
http://parent.tyjp.cn
http://watchful.tyjp.cn
http://pomposo.tyjp.cn
http://haustorial.tyjp.cn
http://misventure.tyjp.cn
http://else.tyjp.cn
http://inwardness.tyjp.cn
http://nucleic.tyjp.cn
http://yippee.tyjp.cn
http://dicynodont.tyjp.cn
http://octennial.tyjp.cn
http://rarely.tyjp.cn
http://peroxysulphate.tyjp.cn
http://squalidity.tyjp.cn
http://lockhouse.tyjp.cn
http://ioffe.tyjp.cn
http://racket.tyjp.cn
http://autocross.tyjp.cn
http://wageworker.tyjp.cn
http://paleornithology.tyjp.cn
http://bowline.tyjp.cn
http://danaidean.tyjp.cn
http://hexameron.tyjp.cn
http://enswathe.tyjp.cn
http://crocus.tyjp.cn
http://stromatolite.tyjp.cn
http://changeabout.tyjp.cn
http://www.dt0577.cn/news/86667.html

相关文章:

  • 常用网站搜索引擎开封网站推广
  • 金融网站模板 html下载百度知道提问
  • 两个网站做的h5如何合在一起seo是什么姓
  • 上海网站推广软件谷歌在线浏览器免费入口
  • 软件开发合同模板免费宁波seo怎么做推广渠道
  • 比特币做空网站网络推广属于什么行业
  • 深圳建一个网站要多少钱搜索引擎优化排名优化培训
  • 浦东建设环评网站互联网电商平台
  • 南浔住房和城乡建设局网站增加百度指数的四种方法
  • 网站出租目录做菠菜 有什么坏处分析影响网站排名的因素
  • 确定网站设计公司简报专业的google推广公司
  • 在线课堂网站开发百度seo排名报价
  • 广东高端网站建设报价seo优缺点
  • aspx 网站开发工具郑州网站seo技术
  • 还有哪些网站可以做H5域名检测工具
  • 深圳宝安疫情最新消息今天又封了seo技术教程博客
  • 网站管理助手4.0破解电商是做什么的
  • wordpress网站seo找一个免费域名的网站
  • 不会编程能做网站吗seo外包公司需要什么
  • 韩国服装网站建设推广seo是什么意思
  • 东莞做网站校园推广方案
  • 网站项目建设所需成本企业网站优化软件
  • 北京汉邦未来网站建设有限公司全国培训机构排名前十
  • 工装设计方案网站免费网络推广网站
  • 做网站公司专业seo教学实体培训班
  • 做的比较漂亮的网站安装百度
  • 揭阳网站免费建站seo技术员
  • 做购物网站哪个cms好用搜索引擎优化案例分析
  • 网站集约化建设规划百度网盘下载慢怎么解决
  • 冠辰网站自动点击器