vue3: how extends components

Viewed 375

parent code

export default defineComponent({
  name: 'LookupBase',
  setup (props, context) {
    const showLabel = ref('')
    return {
       showLabel 
    };
...

extend code:

export default defineComponent({
  name: 'LookupLabel',
  props: {},
  extends: LookupBase,
  setup (props, context) {
     return {
         parentShowLabel: super.showLabel
     }
...

question1:mount LookupLabel after parent LookupBase setup not run?
chinese:挂载LookupLabel之后发现父组件不会执行steup()这个方法,super()?

question2:extend LookupLabel how quote parent LookupBase variable or function?
chinese:LookupLabel如何引用父组件的方法和变量?

online code link https://codesandbox.io/s/nifty-violet-mc6h7

0 Answers
Related