背景
vant 在试用 popup 组件之后,在使用 showtoast toast 为白色文字不出现。
分析
通过查看css发现是,toast 的css 存在一个popup 的类 ,导致 background-color 被设置为了白色看不到,核心是改色就可以实现。
具体解决
1 将 showtoast 的内容组件迁移到组件内部 2 传入 css 类名增加 toast 的 css 类名,样式background-color 改为toast背景色即可 3 css 的类名,需要试用deep,将类透传到子组件