0

我正在尝试创建 1 个可重复使用的间隙变量,我可以在任何有多个按钮的地方使用它。而不是使用gap-3我只想使用gap-buttons

module.exports = {
  theme: {
    extend: {
      gap: {
        buttons: theme(theme.gap.3),
      },
    },
  },
};

我得到的错误是Maximum call stack size exceeded. 我试过buttons: (theme) => theme(theme.gap.3)也没有用。还有颜色,它不起作用......

module.exports = {
  theme: {
    extend: {
      colors: {
       alert: theme => theme('colors.red')
      }
    },
  },
};
4

1 回答 1

0

我的一个项目中确实有这种代码,不确定它是否有帮助(那个是tailwind v1,没有extend

borderColor: (theme) => ({
  ...theme('colors'),
  default: theme('colors.gray.300', 'currentColor'),
}),

你的代码看起来像这样

colors: (theme) => ({
  alert: theme('colors.red')
})
于 2021-09-13T10:16:18.893 回答