Skip to content

scoped attribute make to modify css difficulty or unreasonable #7067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2ue opened this issue Nov 16, 2017 · 3 comments
Closed

scoped attribute make to modify css difficulty or unreasonable #7067

2ue opened this issue Nov 16, 2017 · 3 comments

Comments

@2ue
Copy link

2ue commented Nov 16, 2017

Version

2.5.3

Reproduction link

https://codesandbox.io/s/ql3nvkv489

Steps to reproduce

A.vue and B.vue, they all set a scoped arrtibute for style tag,
then A import B and I want to modify B's style in A,
but I found it not work

What is expected?

I hope can modify the style of B in A, even if A and B have scoped attribute.
maybe it what adds a attribute-selector in the start of every css selector sentence can solve this problem

What is actually happening?

vue add a attribute-selector in the end of every css selector sentence, so it not work

@yyx990803
Copy link
Member

That's how it's designed to be: scoped CSS means the CSS is scoped to the current component only, not its parent, not its children.

@xue163
Copy link

xue163 commented May 21, 2018

Regarding the bug of scoped, when I introduce js from the outside to manipulate elements to add corresponding sub-elements to elements, at this time, the newly added sub-elements are not in the design style, but the scoped is removed, which can be used normally.

@Justineo
Copy link
Member

You shouldn’t manipulate elements manually in this case. You should only do this to encapsulate really low-level DOM operations, like in directives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants