From 1e795d901ba4536308cccdfa164f4b119ea38cd2 Mon Sep 17 00:00:00 2001 From: colder Date: Mon, 8 Jun 2020 20:39:03 +0800 Subject: [PATCH] fix: line-clamp mixin --- style/mixins.scss | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 style/mixins.scss diff --git a/style/mixins.scss b/style/mixins.scss new file mode 100644 index 0000000..ca8aed3 --- /dev/null +++ b/style/mixins.scss @@ -0,0 +1,17 @@ +@import '~taro-ui/dist/style/mixins'; + +@mixin line($num: 1) { + overflow: hidden; + text-overflow: ellipsis; + + @if ($num == 1) { + white-space: nowrap; + } @else { + display: -webkit-box; + -webkit-line-clamp: $num; + + // 以叹号开头的注释才能逃过 postcss-loader. https://juejin.im/post/5ce4abb0518825332550c105 + /*! autoprefixer: ignore next */ + -webkit-box-orient: vertical; + } +}