日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > vue >内容正文

vue

vue使用,问题

發(fā)布時(shí)間:2025/6/17 vue 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue使用,问题 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

參考鏈接:https://cn.vuejs.org/v2/guide/index.html

*)[Vue warn]: Error in v-on handler: "TypeError: $form.postJSON is not a function"

[Vue warn]: Error in v-on handler: "TypeError: $form.postJSON is not a function"(found in <Root>) warn @ vue.js:634 logError @ vue.js:1893 globalHandleError @ vue.js:1888 handleError @ vue.js:1848 invokeWithErrorHandling @ vue.js:1871 invoker @ vue.js:2188 original._wrapper @ vue.js:7541 #錯(cuò)誤2 vue.js:1897 TypeError: $form.postJSON is not a functionat Vue.submit (forTest.html:94)at invokeWithErrorHandling (vue.js:1863)at HTMLFormElement.invoker (vue.js:2188)at HTMLFormElement.original._wrapper (vue.js:7541)

  報(bào)錯(cuò)代碼

var vms = new Vue({el: '#vm',data: {email: '',passwd: ''},methods: {submit: function (event) {console.log(1);event.preventDefault();//和form中添加v-on:submit.prevent="submit"是一樣的var$form = $('#vm'),email = this.email.trim().toLowerCase(),data = {email: email,passwd: this.passwd === '' ? '' : CryptoJS.SHA1(email + ':' + this.passwd).toString()};$form.postJSON('/api/authenticate', data, function (err, result) {if (!err) {console.log(2);// location.assign('/');}});}}});

  應(yīng)該是$form.postJson()中的數(shù)據(jù)寫(xiě)法除了問(wèn)題,參考https://blog.csdn.net/qq_36370731/article/details/80290680

?

*)必須把js代碼寫(xiě)進(jìn)body里的script里,是因?yàn)榇a沒(méi)有自動(dòng)執(zhí)行(未解決,一引入jquery(或者uikit的js)就不行了)

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script> $(function () {//必須放在這里console.log(2);var app2 = new Vue({el: '#app-2',data: {message: '頁(yè)面加載于 ' + new Date().toLocaleString()}})})


  更新:必須把這個(gè)寫(xiě)進(jìn)body里的script里的標(biāo)簽里,就算只有一個(gè)vue也必須這樣,否則會(huì)未定義vue名,像下面這個(gè)自動(dòng)提示時(shí)證明成功了

?

轉(zhuǎn)載于:https://www.cnblogs.com/Gaoqiking/p/10781042.html

總結(jié)

以上是生活随笔為你收集整理的vue使用,问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。