珠宝小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
344 B

3 months ago
  1. const toLine = (name) => {
  2. return name.replace(/([A-Z])/g, '-$1').toLowerCase();
  3. }
  4. /**
  5. * style对象转化为style字符串
  6. * @return {string}
  7. */
  8. export const getStyleStr = (styleObject) => {
  9. let transfrom = '';
  10. for (let i in styleObject) {
  11. let line = toLine(i);
  12. transfrom += line + ':' + styleObject[i] + ';';
  13. }
  14. return transfrom
  15. }