Coder Social home page Coder Social logo

Comments (3)

honkinglin avatar honkinglin commented on May 18, 2024

早期就是下面这样的写法,当时处理按需加载的时候发现由于导出的 Button 变量都指向了同一个引用也就是 Button.tsx 从而跳过 button/index.ts 的导入直接进入 button/Button.tsx 的编译,丢失了 style 的样式文件,中间重新赋值给了 _Button 变量就可以避免指向同一个引用保留住了 style 样式文件

from tdesign-react.

Go7hic avatar Go7hic commented on May 18, 2024

早期就是下面这样的写法,当时处理按需加载的时候发现由于导出的 Button 变量都指向了同一个引用也就是 Button.tsx 从而跳过 button/index.ts 的导入直接进入 button/Button.tsx 的编译,丢失了 style 的样式文件,中间重新赋值给了 _Button 变量就可以避免指向同一个引用保留住了 style 样式文件

原来如此,没注意你们在这个组件入口的地方引入样式文件,一般样式在组件本身(Button.tsx)里引入,可能和你们采用的 CSS 方案有关吧。

from tdesign-react.

honkinglin avatar honkinglin commented on May 18, 2024

早期就是下面这样的写法,当时处理按需加载的时候发现由于导出的 Button 变量都指向了同一个引用也就是 Button.tsx 从而跳过 button/index.ts 的导入直接进入 button/Button.tsx 的编译,丢失了 style 的样式文件,中间重新赋值给了 _Button 变量就可以避免指向同一个引用保留住了 style 样式文件

原来如此,没注意你们在这个组件入口的地方引入样式文件,一般样式在组件本身(Button.tsx)里引入,可能和你们采用的 CSS 方案有关吧。

你说的在组件本身(Button.tsx) 里引入也是一个方案,那样的话确实也能保留住样式文件,不过感觉管理起来可能会比较混乱,不同组件有不同的叫法(Button.tsx、Input.tsx...),有的组件还需要嵌套其他子组件就需要引入对应文件夹下的 tsx 文件,文件层级跟代码约束比较多,统一在 index.ts 文件里处理看起来也比较规范一些

from tdesign-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.