私はVueJSインスタンス内のmaterializecssフレームワークからモーダルをトリガーしようとしています。VueJS - materializeからのモーダル
VueJS
とMaterializecss
の両方が正しく実装されています。両方のフレームワークで、うまく動作します。エラーでオープンボタンの結果をクリックする
:
Uncaught TypeError: data[option] is not a function at HTMLDivElement. (adminarea.js:24562) at Function.each (adminarea.js:10567) at jQuery.fn.init.each (adminarea.js:10356) at jQuery.fn.init.Plugin [as modal] (adminarea.js:24556) at Vue$3.showLoader (adminarea.js:21396) at boundFn (adminarea.js:54956) at HTMLButtonElement.invoker (adminarea.js:56467)
これは私のVueのインスタンスである:
const app = new Vue({
el: '#app',
data: {
activeUser: {
username: '',
email: ''
},
},
methods: {
showLoader(){
$('#loaderModal').modal('open');
},
closeLoader(){
$('#loaderModal').modal('close');
}
},
mounted() {
// Get current User
axios.get('/api/currentUser')
.then(response => {
this.activeUser.username = response.data.username;
this.activeUser.email = response.data.email;
});
},
components: {
Admindashboard
}
});
そしてここでは、モーダル構造を持つ私のhtmlファイルの一部です:
<!-- Modal Structure -->
<div id="loaderModal" class="modal">
<div class="modal-content">
<h4>Fetching data..</h4>
<div class="progress">
<div class="indeterminate"></div>
</div>
</div>
</div>
<button class="btn cyan waves-effect waves-cyan" v-on:click="showLoader">Open</button>
ありがとう!
これを解決しましたか? – d00dle
残念ながら.. – Brotzka
私は私が解決した鉱山を追加することができますが、私は別のCSSフレームワークを使用します。私のインスタンスでは、(特定のモジュール用に)インポートしてjQuery変数に適用する必要があったのは、CSSフレームワークのjsモジュールでした。あなたのケースが同じかどうかはわかりませんが、試してみる価値があります。 – d00dle