//Step1 - Using string funClass to convert to class
String funClass = "package.myclass";
Class c = Class.forName(funClass);
//Step2 - instantiate an object of the class abov
Object o = c.newInstance();
//Prepare array of the arguments that your function accepts, lets say only one string here
Class[] paramTypes = new Class[1];
paramTypes[0]=String.class;
String methodName = "mymethod";
//Instantiate an object of type method that returns you method name
Method m = c.getDeclaredMethod(methodName, paramTypes);
//invoke method with actual params
m.invoke(o, "testparam");
Существует способ обойти это, используя атрибуты :style
.
Добавить вычисленное свойство:
computed: {
cssProps () {
return {
'--secondary-color': this.$vuetify.theme.secondary
}
}
Привязать стиль к cssProps:
<div id="app" :style="cssProps">
Затем, в вашем стиле:
<style scoped>
label
color: var(--secondary-color);
</style>
Адаптировано из этого обсуждения: https://github.com/vuejs/vue/issues/7346
На github есть Feature Request
: цвета темы доступа в файлах стилуса
@KaelWD (один из разработчиков) написал :
Это то, что вам нужно реализовать самостоятельно. Я попытался сделать что-то подобное раньше, но на самом деле он не работает на уровне фрейма.
Проблема помечена как
wontfix
var(--secondary-color)
не анализируется. Возможно, сборка настроена неправильно? – Anima-t3d 18 June 2018 в 08:51