Coder Social home page Coder Social logo

Comments (7)

jia000 avatar jia000 commented on May 18, 2024

弹窗警告,这个是一个vue组件吗,是在什么时机下created?

from tmagic-editor.

jia000 avatar jia000 commented on May 18, 2024

修改core的方法,直接改原型链或者或defineProperty,但是不建议这么做,还是看看是什么问题,完善一下core好点

from tmagic-editor.

kevnwei avatar kevnwei commented on May 18, 2024

就是上面“中奖弹窗”的一个openAlert方法,调试用的方法。


<template>
  <div class="magic-ui-awardpopup">
    <div>{{config.award_title}}</div>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType, } from 'vue';
import Core from '@tmagic/core';
import { MAwardpopup } from '../types';
import useApp from '../useApp';

export default defineComponent({
  name: 'magic-ui-awardpopup',
  props: {
    config: {
      type: Object as PropType<MAwardpopup>,
      default: () => ({}),
    },

    model: {
      type: Object,
      default: () => ({}),
    },
  },
  setup(props) {
    const app: Core | undefined = useApp(props);
    const node = app?.page?.getNode(props.config.id);
    const openAlert = () => {
      alert(333);
    };

    return {
      openAlert,
    };
  },
});
</script>

from tmagic-editor.

kevnwei avatar kevnwei commented on May 18, 2024

原因就是 被调用方法所属的组件 事件触发的时候还没创建好。
如本case的事件,同时触发两个动作,1: 蒙层弹出,2: 蒙层里面的“中奖弹窗”组件(此时还没创建好,instance为undefined),导致调用instance里面的方法失败。

from tmagic-editor.

jia000 avatar jia000 commented on May 18, 2024

明白了,这里我改一下core,需要维护一个事件调用的队列,如果instance还没有把method放入队列,等instance created在去队列里拿method调用

from tmagic-editor.

jia000 avatar jia000 commented on May 18, 2024

1750467

from tmagic-editor.

jia000 avatar jia000 commented on May 18, 2024

v1.1.0-beta.3

from tmagic-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.