I am working on a project that I inherited from someone else, and I see a lot of <p-xxxx>
tags, such as <p-page :has-something="val1" :has-another="val2" />
, etc.(e.g. CompName -->
I'm looking around the directories and found a component called Page.vue
that has such props in it: has-something
and has-another
. And structurally speaking, I'm sure the <p-page>
corresponds to this component.
So how did this work? I checked the component's name
field and it says Page
.
EDIT: I should also note that the component isn't registered at all. It's not imported either. I'm guessing it has something to do with
import '@/globals';
import '@/plugins';
in main.js
, because I know we're using our proprietary UI component library. Can anyone point to where I can go read more about how this works? I thought I was pretty good at Vue, but apparently not good enough.
答案 0 :(得分:1)
这取决于该组件如何在父组件中注册,例如,Page
组件是否注册为:
components: {
PPage: Page
}
然后在template
中,您将此组件称为<p-page ...
答案 1 :(得分:1)
我知道了。
在我们正在使用的专有库中,使用p-
作为前缀导出了组件,并且该库通过vue.config.js
注入了整个应用程序,因此没有任何导入在单个组件中。