hbulider x项目转小程序报错——wxConfig is not defined

问题遇到的现象和发生背景

在hbulder x中创建了一个项目,一共只有两个页面,在转wx小程序运行时就报错了,不知道和app id有没有关系(id是登录账号自动生成的)

问题相关代码, vue的两个页面和一个pages.jason
<template>
    <view>
        about
        <!-- @scroll滚动时触发 -->
        <scroll-view class="scrool" :scroll-y="true" @scroll="scroll">
            <view v-for="i in 100">111</view>
        </scroll-view>
    </view>
</template>

<script src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" type="text/javascript"></script>
<script>
    export default {
        data() {
            return {

            }
        },
        methods: {
            scroll(event){
                console.log(event)
            }
        }
    }
</script>

<style>
    .scrool{
        height: 200px;
    }
</style>
<template>
    <view :class="msg" v-bind:data="true ? 'yes' : 'no'">
        {{msg}}
        <button @click="show">点击</button>
        <!-- 2.v-model:数据双向绑定-->
        <input v-model="msg" />
        <view v-if="flag">hello my oldfirends</view>
        <view v-else>fighting</view>
        <view v-show="flag">lalalalala</view>

        <!-- 空标签 -->
        <block v-if="flag">
            <view>aaa</view>
            <view>bbb</view>
        </block>

        <view v-for="(item,index) in arr">{{index + 1}}:{{item}}</view>
        <view v-for="(value,key) in person">{{key}}:{{value}}</view>
        <view v-for="p in persons">
            <view>姓名:{{p.name}}</view>
            <view>年龄:{{p.age}}</view>
        </view>
    </view>
</template>

<script src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" type="text/javascript"></script>

<script>
    export default {
        data() {
            return {
                msg: '你好啊',
                flag: true,
                arr: ['vue', 'h5', 'js'],
                person: {
                    name: '章三',
                    age: '16'
                },
                persons: [
                    {name: '望湖',
                    age: '16'},
                    {name: '丽丽',
                    age: '14'}
                ]
            }
        },
        onLoad() {
            setTimeout(() => {
                this.msg = this.msg + 'Tom'
            }, 2000)
        },
        methods: {
            show() {
                console.log('点击了按钮');
                this.flag = !this.flag;
            }
        }
    }
</script>

页面配置是这样的

{
    "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "uni-app"
            }
        }
        ,{
            "path" : "pages/about/about",
            "style" :                                                                                    
            {
                "navigationBarTitleText": "",
                "enablePullDownRefresh": false
            }
            
        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "uni-app",
        "navigationBarBackgroundColor": "#F8F8F8",
        "backgroundColor": "#F8F8F8"
    },
    "tabBar": {
        "color": "#7A7E83",
        "selectedColor": "#3cc51f",
        "borderStyle": "black",
        "backgroundColor": "#ffffff",
        "list": [{
            // taBar可以切换的路径 未选中时的图标 选中时的图标 名字
            "pagePath": "pages/index/index",
            "iconPath": "static/home.png",
            "selectedIconPath": "static/home_selected.png",
            "text": "首页"
        }, {
            "pagePath": "pages/about/about",
            "iconPath": "static/mine.png",
            "selectedIconPath": "static/mine_selected.png",
            "text": "我的"
        }]
    }
}
运行结果及报错内容

Uncaught ReferenceError: __wxConfig is not defined at instanceframe?s=1641517190926&autoload:1

img

我尝试过方法

有网友说在页面中添加:

<script src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" type="text/javascript"></script>  

然而,在wx小程序开发工具中依然报错: __wxConfig is not defined at instanceframe?s=1641517190926&autoload:1

所以,谁能教教我怎么解决吖,谢谢啦

不对吧

img

你的账号有绑定appid对应的公众号吗?我记得随机是会报这个错