Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复 getPxTransform 中无配置 deviceRatio 时报错的问题 #14352

Merged
merged 6 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/taro-api/src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function getPxTransform (taro) {
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
}
const formatSize = ~~size
let rootValue = 1 / config.deviceRatio[designWidth]
let rootValue = 1 / deviceRatio[designWidth]
switch (config.targetUnit) {
case 'rem':
rootValue *= baseFontSize * 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ exports[`babel should convert do expressions 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ exports[`compiler-macros - defineAppConfig and definePageConfig should read app
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ exports[`config should build from origin and pipe to output 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -1827,7 +1827,7 @@ I m irrelevant.
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -2762,7 +2762,7 @@ exports[`config should resolved alias 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ exports[`css modules should use css modules with global mode 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -1855,7 +1855,7 @@ exports[`css modules should use css modules with module mode 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ exports[`nerv should build nerv app 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ exports[`react should build react app 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ exports[`sass should build app with sass 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -1798,7 +1798,7 @@ exports[`sass should build app with scss 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -2729,7 +2729,7 @@ exports[`sass should set global sass content with data 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -3660,7 +3660,7 @@ exports[`sass should set global sass content with source & dir 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down Expand Up @@ -4591,7 +4591,7 @@ exports[`sass should set global sass content with source 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ exports[`subpackages should process subpackages 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ exports[`typescript should build project with ts 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ exports[`vue should build vue app 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ exports[`vue3 should build vue3 app 2`] = `
throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!"));
}
var formatSize = ~~size;
var rootValue = 1 / config.deviceRatio[designWidth];
var rootValue = 1 / deviceRatio[designWidth];
switch (config.targetUnit) {
case "rem":
rootValue *= baseFontSize * 2;
Expand Down