3***@qq.com
3***@qq.com
  • 发布:2024-07-30 19:04
  • 更新:2024-07-30 19:22
  • 阅读:595

Please do not register multiple Pages 微信小程序

分类:uni-app

《my.vue》
<template>
<!-- #ifdef MP-WEIXIN -->
<view>
<view>
<!-- 获取手机号使用手机号登录 -->
<button type="primary" class='btn' open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">使用手机号登录</button>
</view>
</view>
<!-- #endif -->
</template>

<script setup>
Page({
getPhoneNumber (e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
}
})
</script>

<style>

.btn {  
    background: #1890FF !important;  
    line-height: 80rpx !important;  
    border-radius: 80rpx !important;  
    margin: 70rpx 50rpx !important;  
    font-size: 35rpx !important;  
}  

</style>

微信报错
Please do not register multiple Pages in pages/src/SearchInerface.js(env: Windows,mp,1.06.2405020; lib: 3.5.0)
vendor.js? [sm]:3200 [Vue warn]: Unhandled error during execution of setup function
at <My >
vendor.js? [sm]:3366 Error: APP-SERVICE-Engine:Please do not register multiple Pages in pages/src/SearchInerface.js
[Vue warn]: Component is missing template or render function.
at <My >

我的searchinerface.VUE根本没有重复注册,当我删除searchinerface.VUE其他vue组件报这个错了,我的其他组件也没有注册page{},这个错误要如何解决呢?

2024-07-30 19:04 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

是你这个Page的问题吧,你按照vue写法,别按照微信小程序写法

  • 3***@qq.com (作者)

    请问vue怎么写

    2024-07-30 19:29

  • DCloud_UNI_yuhe

    回复 3***@qq.com:


    <script>  
    export default {
    data() {
    return {
    // 选项列表
    }
    },
    onLoad() {

    },
    methods: {
    getPhoneNumber (e) {
    console.log(e.detail.code) // 动态令牌
    console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
    console.log(e.detail.errno) // 错误码(失败时返回)
    }
    }
    }
    </script>

    2024-07-30 19:31

  • 3***@qq.com (作者)

    回复 DCloud_UNI_yuhe: 谢谢你,好人有好报

    2024-07-31 08:14

要回复问题请先登录注册