Php 加载页面后插入页面时未初始化Vue组件
我正在尝试在页面完全加载后将vue组件插入页面 当htlm已经在页面上时,该组件工作正常 这是包含以下组件的刀片:Php 加载页面后插入页面时未初始化Vue组件,php,jquery,laravel,vue.js,widget,Php,Jquery,Laravel,Vue.js,Widget,我正在尝试在页面完全加载后将vue组件插入页面 当htlm已经在页面上时,该组件工作正常 这是包含以下组件的刀片: <div id="widget{{ $item->getId() }}"> <input type="hidden" name="settings[{{ $item->getId() }}][keep]" value="1" /> <fieldset class="widget-pod"> <legend clas
<div id="widget{{ $item->getId() }}">
<input type="hidden" name="settings[{{ $item->getId() }}][keep]" value="1" />
<fieldset class="widget-pod">
<legend class="title-legend visuallyhidden">Image</legend>
<imageupload
width="{{ $width }}"
height="{{ $height }}"
input-name="settings[{{$item->getId()}}][image]"
path="{{ $item->downloadRoute('content_id') }}"
alt="{{ $settings->get('image_alt') }}">
</imageupload>
</fieldset>
</div>
}) 你的根Vue实例在哪里?它在我的app.js中,在resources/assets/js中。要清楚,js代码在你的VueJS组件中?不,用于将元素添加到页面的js代码不在组件中。它包含在组件之前的页面中。
this.add = function(element, callback) {
var naturalHeight = $(element).height();
$(element)
.css('height', 0)
.css('max-height', '999999px')
.css('min-height', 0)
.animate({
height: naturalHeight + 'px'
},
this.getDuration() * 1000,
function() {
removeHeightAndSetMarginAndPadding($(element));
//if the natural height changes throughout the animation, some javascipt happened so let's just animate it again
if ($(element).height() !== naturalHeight) {
var newNaturalHeight = $(element).height();
$(element)
.css('height', naturalHeight)
.animate({
height: newNaturalHeight + 'px'
},
(self.getDuration() / 2 * 1000),
function() {
if ($.isFunction(callback)) {
callback();
}
}
);
} else {
if ($.isFunction(callback)) {
callback();
}
}
}
);