Skip to content
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

How to dynamically access a specific object within a variable and iterate over it #3801

Open
hututu-yo opened this issue Jun 15, 2023 · 0 comments
Labels

Comments

@hututu-yo
Copy link

@theme-color-value: {
@light: {
@page-name: {
color: #df3232;
}

@modal-name: {
  color: #7ac13c;
}

}

// 对应某个主题
@dark: {

// 对应某个模块的颜色
@page-name: {
  color: #166ad0;
}

@modal-name: {
  color: #a51575;
}

}
}

@theme-color: {
@page-name: {
text-color-primary: 10%;
bg-color: 10%;
text-color-secondary: 100%;
}

@modal-name: {
text-color-primary: 10%;
bg-color: 10%;
text-color-secondary: 100%;
}
}

.ccc {
color: @theme-color[@page-name][text-color-primary];
}

@color-property: text-color-primary;

.ccc {
// color:~"@{theme-color[@{page-name}][@{color-property}]}";
}

each(@theme-color-value, .(@value, @key) {
@data-theme: replace(@key , '@', '');

[data-theme=~"@{data-theme}"] {
  each(@value, .(@v, @k, @i) {
      @color: @v[color];
      color: "@{theme-color[@{k}]}";
      ss: '@{theme-color}[(~"@{k}")]';
      // 循环@theme-color中的某个对象

      // each(@theme-color[e("@{k}")], .(@vv, @kk) {// 这里如何动态获取 @theme-color 中的某个对象
      //     // --@{kk}: @color;
      //     // color: @vv;
      //   }

      // );

    }

  );
}

}

);

@hututu-yo hututu-yo added the bug label Jun 15, 2023
@iChenLei iChenLei changed the title 如何动态获取 某个变量 中的某个对象 并循环 How to dynamically access a specific object within a variable and iterate over it Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant