在iframe元素加载拖放后无法运行Vue.js

时间:2017-02-13 20:44:35

标签: javascript html iframe vuejs2 vue-component

我试图在创建iframe元素之后执行Vue.js组件,但它不起作用。

以下是iframe示例:

<div id="screen">
<!-- This iframe created after drag and drop-->
<iframe src="/elements/cover-01.html" scrolling="no" frameborder="0" __idm_frm__="419" __idm_id__="-2084740094" style="visibility: visible; user-select: none; overflow: hidden; height: 500px; width: 2105px; opacity: 1;">
<texeditor></texteditor>
</iframe>
</div>

app.js

import Vue from 'vue';
import axios from 'axios';

import Texteditor from './components/Texteditor.vue';

new Vue({
    el:'#screen',
    components:{Texteditor}  
});

Texteditor.vue(组件)

<template>
    <div  @click="removeEdit">
        <p><slot></slot></p>
        <textarea  v-show="edit" class="texteditor"></textarea>
    </div>
</template>
<script>
export default{
    data(){
        return {
            edit: false
        }
    },
    methods:{
        toggleEdit(){
            this.edit = !this.edit;
            $('.texteditor').redactor({
                fixed:true
            });
        },
        removeEdit(){
            this.edit=false;
            $('.texteditor').destroyEditor();
        }
    },
    mounted(){
        alert();
    }
}
</script>
<style>
</style>

我正在测试texteditor组件,但我无法获得。

请帮忙。

由于

1 个答案:

答案 0 :(得分:0)

您可能在<texeditor></texteditor>中有拼写错误,应该是texTeditor