uni-app icon indicating copy to clipboard operation
uni-app copied to clipboard

编译成飞书小程序,index.vue文件中this.$refs为空,index.vue换成其他名字就可以了

Open woailinger opened this issue 3 years ago • 0 comments

问题描述 uni-app编译成飞书小程序,路由文件pages/*/index.vue中,使用uni-forms组件,绑定ref属性,然后事件函数中this.$refs为空,把index.vue换成其他名字就可以了。

package.json中的依赖 "dependencies": { "@dcloudio/uni-app-plus": "^2.0.1-33920220208001", "@dcloudio/uni-h5": "^2.0.1-33920220208001", "@dcloudio/uni-helper-json": "", "@dcloudio/uni-i18n": "^2.0.1-33920220208001", "@dcloudio/uni-mp-360": "^2.0.1-33920220208001", "@dcloudio/uni-mp-alipay": "^2.0.1-33920220208001", "@dcloudio/uni-mp-baidu": "^2.0.1-33920220208001", "@dcloudio/uni-mp-jd": "^2.0.1-33920220208001", "@dcloudio/uni-mp-kuaishou": "^2.0.1-33920220208001", "@dcloudio/uni-mp-lark": "^2.0.1-33920220208001", "@dcloudio/uni-mp-qq": "^2.0.1-33920220208001", "@dcloudio/uni-mp-toutiao": "^2.0.1-33920220208001", "@dcloudio/uni-mp-vue": "^2.0.1-33920220208001", "@dcloudio/uni-mp-weixin": "^2.0.1-33920220208001", "@dcloudio/uni-quickapp-native": "^2.0.1-33920220208001", "@dcloudio/uni-quickapp-webview": "^2.0.1-33920220208001", "@dcloudio/uni-stat": "^2.0.1-33920220208001", "@dcloudio/uni-ui": "^1.4.12", "@vue/shared": "^3.0.0", "core-js": "^3.6.5", "crypto-js": "^4.1.1", "dayjs": "^1.11.2", "flyio": "^0.6.2", "regenerator-runtime": "^0.12.1", "vue": "^2.6.11", "vue-class-component": "^6.3.2", "vue-property-decorator": "^8.0.0", "vuex": "^3.2.0" }, "devDependencies": { "@babel/plugin-syntax-typescript": "^7.2.0", "@babel/runtime": "~7.12.0", "@dcloudio/types": "", "@dcloudio/uni-automator": "^2.0.1-33920220208001", "@dcloudio/uni-cli-i18n": "^2.0.1-33920220208001", "@dcloudio/uni-cli-shared": "^2.0.1-33920220208001", "@dcloudio/uni-migration": "^2.0.1-33920220208001", "@dcloudio/uni-template-compiler": "^2.0.1-33920220208001", "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-33920220208001", "@dcloudio/vue-cli-plugin-uni": "^2.0.1-33920220208001", "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-33920220208001", "@dcloudio/webpack-uni-mp-loader": "^2.0.1-33920220208001", "@dcloudio/webpack-uni-pages-loader": "^2.0.1-33920220208001", "@types/crypto-js": "^4.1.1", "@vue/cli-plugin-babel": "~4.5.15", "@vue/cli-plugin-typescript": "~4.5.11", "@vue/cli-service": "~4.5.15", "babel-plugin-import": "^1.11.0", "cross-env": "^7.0.2", "jest": "^25.4.0", "mini-types": "", "miniprogram-api-typings": "", "postcss-comment": "^2.0.0", "sass": "1.49.7", "sass-loader": "10.1.1", "typescript": "^3.0.0", "vue-template-compiler": "^2.6.11" } 预期结果 能够获取this.$refs,从而进行this.$refs[ref].validate()操作

实际结果 this.$refs为{}

补充信息 解决方法: index.vue 换成 xxx.vue 等其他名字就可以了

woailinger avatar May 20 '22 15:05 woailinger