无法计算template-columns
来源:4-6 组件嵌套和投影组件(2)
klr106
2019-09-29
#这条语句无效:return repeat(${this.cols},calc((100vw-${this.displayCols*0.4}rem)/${this.displayCols})); 然后导致sliderMargin也不能拉到最右边
不知道怎么改这个calc()函数,好像对vm不支持,我用的是google浏览器
能讲解一下吗?
写回答
1回答
-
接灰的电子产品
2019-10-08
要注意这个渲染后是这样的 css 属性
grid-template-columns: repeat(8, calc((100vw - 2rem) / 5));
所以构造字符串时要注意一下,哪些是计算,哪些是字符串
public get templateColumns(): string { return `repeat(${this.cols}, calc((100vw - ${this.displayCols * 0.4}rem) / ${this.displayCols}))`; }00
相似问题