【问题标题】:Couldnt run Vue.js after iframe elements loaded with drag and drop通过拖放加载 iframe 元素后无法运行 Vue.js
【发布时间】:2017-07-01 23:28:53
【问题描述】:

我试图在创建 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 组件进行测试,但我无法获得。

请帮忙。

谢谢

【问题讨论】:

    标签: javascript html iframe vuejs2 vue-component


    【解决方案1】:

    可能是你在&lt;texeditor&gt;&lt;/texteditor&gt; 中有错字,应该是 texTeditor

    【讨论】:

    • 没有。错字没有错误。创建iframe后在iframe之外工作。但创建iframe时在iframe中不起作用。
    猜你喜欢
    • 2021-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-21
    • 2016-09-15
    • 1970-01-01
    • 2014-12-10
    相关资源
    最近更新 更多