codercup / unibest

unibest - 最好用的 uniapp 开发框架。unibest 是由 uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI 驱动的跨端快速启动模板,使用 VS Code 开发,具有代码提示、自动格式化、统一配置、代码片段等功能,同时内置了大量平时开发常用的基本组件,开箱即用,让你编写 uniapp 拥有 best 体验。
https://codercup.github.io/unibest-docs/
MIT License
1.4k stars 178 forks source link

使用uni-ui库中的uni-popup, 代码使用的官方提供的demo,报错 #28

Closed webarn closed 4 months ago

webarn commented 4 months ago
<route lang="json5">
{
  layout: 'demo',
  style: { navigationBarTitleText: 'UniUI 使用' },
}
</route>

<template>
  <view>
    <button @click="open">打开弹窗</button>
    <uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0"
      >底部弹出 Popup 自定义圆角</uni-popup
    >
  </view>
</template>
<script>
export default {
  methods: {
    open() {
      // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
      this.$refs.popup.open('top')
    },
  },
}
</script>
image

问题2: http://localhost:9000/#/pages/demo/route-interceptor/login-model?name=feige&age=30 这个页面也报错,

image

上面代码都是执行 pnpm create unibest my-project -t demo后得到的代码,无修改

webarn commented 4 months ago

uni-drawer也报错,和上面的错误一样

codercup commented 4 months ago

image image 没问题呀~

codercup commented 4 months ago

推荐使用 vue3+setup 语法

<script lang="ts" setup>
const popup = ref()
const open = () => {
  popup.value?.open()
}
</script>
codercup commented 4 months ago

image

webarn commented 4 months ago

@codercup 找到问题了,如果使用 http://localhost:9000/ 必现,如果使用ip就正常使用。最终排查非best的原因,是因为 广告拦截软件把:http://localhost:9000/node_modules/.pnpm/@dcloudio+uni-ui@1.5.0/node_modules/@dcloudio/uni-ui/lib/uni-popup/keypress.js?v=3a0ce4b7当做广告拦截了。谢谢大佬的回复