c***@qq.com
c***@qq.com
  • 发布:2023-05-25 22:26
  • 更新:2023-05-26 16:09
  • 阅读:229

___封贴

分类:uni-app

2023-05-25 22:26 负责人:无 分享
已邀请:
piaoyi_UI

piaoyi_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序

双问号有啥问题,截图看看咋写的,报什么错误

c***@qq.com

c***@qq.com (作者)

<template>  
  <view @click="handleClick">123</view>  
</template>  

<script setup>  

import { ref } from "vue";  

const someVal = '';  

const msg = ref('')  

function handleClick() {  
  const temp = msg.value ?? "1111"  
  console.log(temp)  
}  
</script>  
<style lang="scss" scoped>  
</style>  

看来真是bug 今天你说什么问题,我又测试了一下,不用ref 的变量是可以的,用someVal 是可以的,就是点击微信小程序开发者工具,的预览,上传,编译就要报错。

message:Error: 非法的文件,错误信息:invalid file: pages/index/index.js, 1:129, SyntaxError: Unexpected token ?"use strict";const e=require("../../common/vendor.js"),o={__name:"index",setup(o){const n=e.ref("");function s(){const e=n.value??"1111";console.log(e)}return(o,n)=>({a:e.o(s)})}},n=e._export_sfc(o,[["__file","/pages/index/index.vue"]]);wx.createPage(n); [20230526 13:23:38][xxxxxxxxxxx]  
appid: xxxxxxxxxxx  
openid: o6zAJszsgKJ0VcY9IgG5yxxxx  
ideVersion: 1.06.2303220  
osType: darwin-x64  
time: 2023-05-26 13:23:39
  • piaoyi_UI

    是双?的原因啊,这是什么写法

    2023-05-26 14:01

c***@qq.com

c***@qq.com (作者)

就是ES6 的双问号啊 :)

要回复问题请先登录注册