今天在使用到vant组件的时候引入报错。
[Vue warn]: Unknown custom element: <van-action-sheet> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
vant的ActionSheet 动作面板,v1、v2新旧版本不一样,名字都不一样。这可太细了。
ActionSheet // 新版本
Actionsheet // 旧版本
import和use的时候要注意,版本不对应就拉了。
import { Actionsheet } from "vant"; // 旧版本
Vue.use(Actionsheet)
import { ActionSheet } from "vant"; // 新版本
Vue.use(ActionSheet)
而且标签名也不一样:
van-action-sheet // 新版本
van-actionsheet // 旧版本