nvue页面使用weex,使用input标签就开始报错
新建页面也不行。
18:01:11.922 Error: [JS Framework] Failed to receiveTasks, instance (14) is not available.
18:01:11.942 Error: [JS Framework] Failed to receiveTasks, instance (16) is not available.
18:01:11.963 Error: [JS Framework] Failed to receiveTasks, instance (18) is not available.
18:01:11.984 Error: [JS Framework] Failed to receiveTasks, instance (20) is not available.
而且是点一次出现很多个这个错误提示,出现上百条错误提示
<template>
<div>
<scroller class="page" ref="list">
<messageChat v-for="(item,index) in contentList" :key="index" :item="item" v-on:sendContentToParent="appendSendContent"
:contentData="contentData"></messageChat>
</scroller>
<div class="btns" ref="btns">
<!-- <input type="text" return-key-type="send" ref="input" @keyboard="getKeyboard" @focus="getFocus()"
placeholder="input placeholder" class="input-sty"> -->
<input class="input-sty" />
<text class="send">发送</text>
</div>
</div>
</template>
<script>
const dom = weex.requireModule("dom");
import messageChat from "@/components/chat/chat"
import {
sendMessage,
formatTime
} from "@/common/public.js";
export default {
data() {
return {
//接受和发送的数据
page: 0,
to_uid: "",
to_head_img: "",
contentList: [],
//用户和对话用户资料
contentData: {
"to_uid": "",
"to_head_img": "null",
"to_user_name": "",
}
}
},
created() {
uni.getStorage({
key: 'chatParams',
success: res => {
let option = JSON.parse(res.data);
uni.setNavigationBarTitle({
title: option.to_user_name
});
//将父页面传值 的to_uid,to_head_img,to_user_name保存下来并传给组件进行渲染
this.contentData.to_uid = option.to_uid;
this.contentData.to_head_img = option.to_head_img;
this.contentData.to_user_name = option.to_user_name;
/* *
* 获取历史聊天记录及标记已读
* @param {Object} type:read 获取聊天记录
* @param {Object} uid 当前用户的uid
* @param {Object} to_uid 对话用户uid
* @param {Object} tag 后端判断用户uid及对话用户uid
* TODO:要根据后端接口修改
*/
let params = {
"type": "read",
"uid": "155970241936805818",
"to_uid": option.to_uid,
"tag": option.tag,
"page": this.page
}
uni.sendSocketMessage({
data: JSON.stringify(params),
success(ret) {},
fail(ret) {
console.log('WebSocket发送信息失败,请检查!错误原因:' + JSON.stringify(ret));
}
})
/**
* 监听WebSocket接受到服务器的消息事件。
* @param {Object} ret
* this.$store.commit("change_message_status", true);
*/
uni.onSocketMessage(ret => {
let getData = JSON.parse(ret.data);
console.log(JSON.stringify(getData.data));
console.log(getData.data.length);
if (getData.data.length > 0) {
getData.data = getData.data.reverse();
for (let i in getData.data) {
getData.data[i].created_time = formatTime(getData.data[i].created_time);
}
this.contentList = getData.data;
}
});
}
});
},
methods: {
//点击对话框外部分关闭软键盘
// closeKeyBoard: function() {
// this.$refs.input.blur();
// },
// appendSendContent(data) {
// this.contentList2.push(data);
// },
/* 页面滚动 */
// scrollAction: function() {
// let el = this.$refs.btns;
// dom.getComponentRect(this.$refs.list, res => {
// dom.scrollToElement(el, {
// offset: res.size.height
// });
// });
// },
// send: function() {
// //this.scrollAction();
// sendMessage(this.sendText, to_uid, content_type);
// let sendParamsToParent = {
// type: "send",
// content_type: content_type,
// content: this.sendText,
// time: "2018年3月23日 XX:xx"
// };
// //将发送的数据传到父组件,并展示出来
// this.$emit("sendContentToParent", sendParamsToParent);
// //清楚对话框已发送的内容
// this.sendText = "";
// },
/* 返回键盘信息 */
// getKeyboard: function(e) {
// // this.listSty=`padding-bottom:${e.keyboardSize}px`;
// // console.log(JSON.stringify(e))
// },
// getFocus: function() {
// this.scrollAction();
// }
},
components: {
messageChat
}
}
</script>
<style>
.page {
background-color: #FFFFFF;
height: 100vh;
}
.btns {
position: fixed;
bottom: 0;
left: 0;
right: 0;
flex-direction: row;
border-top: 1px solid #eeeeee;
background-color: #fff;
}
.input-sty {
flex: 1;
padding: 20px 30px;
border-top-width: 1px;
border-bottom-width: 1px;
border-style: solid;
border-color: rgb(162, 217, 192);
placeholder-color: #41b883;
font-size: 28px;
}
.send {
border-style: solid;
border-color: rgb(162, 217, 192);
border-top-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
padding: 20px 30px;
font-size: 28px;
}
</style>
AustinMan
刚那会我也突然出现这个问题了 我是用真机调试的 进不去页面 后来发现 手机得跟电脑连一个wifi 就好了
2021-06-22 09:57