GithubHelp home page GithubHelp logo

.san 组件的 scoped css 不生效 about san HOT 8 CLOSED

baidu avatar baidu commented on May 2, 2024
.san 组件的 scoped css 不生效

from san.

Comments (8)

errorrik avatar errorrik commented on May 2, 2024

https://github.com/ecomfe/san-loader 去吧,好跟踪 commit

from san.

Dafrok avatar Dafrok commented on May 2, 2024

ecomfe/san-loader#5

那边发过了一个,但最后跟踪到问题是 san 的属性名匹配规则造成的,所以我在这边也发了一个,推敲一下看哪边做适配比较合适。

from san.

Dafrok avatar Dafrok commented on May 2, 2024

在排查 san-loader 的问题时发现了一个其它的问题,san 在会把中划线加数字的 attribute key 当成减法表达式来处理(如 data-foo-1 会编译成 dataFoo-1),不知道算不算是 bug。详见 ecomfe/san-loader#6 最新评论。

from san.

Dafrok avatar Dafrok commented on May 2, 2024

根据下午的讨论,这里产生了四个需求:

  1. 约定 scope id 的生成格式
  2. 对 scope id 所对应的 attribute 做特殊处理,使其即使不进行赋值也不会被 san 忽略
  3. 子组件的根节点要继承父组件的 scope id
  4. 父组件的 slot 要包含子组件的 scope id

注:scope id 由 san-loader 生成,并作为一个 custom attribute 写入 san 组件绑定的真实 DOM 元素。

from san.

errorrik avatar errorrik commented on May 2, 2024

在排查 san-loader 的问题时发现了一个其它的问题,san 在会把中划线加数字的 attribute key 当成减法表达式来处理(如 data-foo-1 会编译成 dataFoo-1),不知道算不算是 bug

这个不是bug。我们认为dat name中不应该包含-,因为identifier是不允许包含-的,在expression里,-会被认为是减号。然而attribute是大小写不敏感并推荐-分割的,为了方便使用,这里做了auto camel

from san.

Dafrok avatar Dafrok commented on May 2, 2024

GET

from san.

errorrik avatar errorrik commented on May 2, 2024

@sw811 data bind时的auto camel可以写一篇practice

from san.

sw811 avatar sw811 commented on May 2, 2024

@errorrik 好的

from san.

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.