dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.15k stars 3.64k forks source link

通过wxcomponents引入vant, 组件,第一次编译,与保存改动的vue文件编译产生的代码不一样 #4161

Open iLMagic opened 1 year ago

iLMagic commented 1 year ago

问题描述 uniapp集成了vant UI组件,通过page.json 引入公共组件,然后在页面中使用组件 <van-field :value="loginform.phone" @input="phoneInput" type="number" clearable maxlength="11" label="手机号" placeholder="请输入手机号" />

phoneInput(e) {
       console.log(e)
 },

复现步骤

  1. 启动 ' yarn run dev:mp-weixin' , 点击事件,打印出来的value的值2. image

2、保存当前vue文件以后,通过--watch的热更新方式,再次触发input事件,打印出来的是 image

3、观察上述两种情况编译出来的微信代码,发现后者在标签页面多了data-com-type="wx"

预期结果 希望uni团队尽快修复此问题,目前我是手动加上了 data-com-type="wx"

实际结果

系统信息:

补充信息

{
    "name": "my-project",
    "version": "0.1.0",
    "private": true,
    "scripts": {
        "dev:wx": "cross-env VUE_APP_ENV=dev NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
        "prod-common:wx": "cross-env VUE_APP_ENV=prod-common NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
        "serve": "npm run dev:h5",
        "build": "npm run build:h5",
        "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
        "build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
        "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
        "build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
        "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
        "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
        "build:mp-jd": "cross-env NODE_ENV=production UNI_PLATFORM=mp-jd vue-cli-service uni-build",
        "build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
        "build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build",
        "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
        "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
        "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
        "build:mp-xhs": "cross-env NODE_ENV=production UNI_PLATFORM=mp-xhs vue-cli-service uni-build",
        "build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
        "build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
        "build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
        "build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
        "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
        "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
        "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
        "dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
        "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
        "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
        "dev:mp-jd": "cross-env NODE_ENV=development UNI_PLATFORM=mp-jd vue-cli-service uni-build --watch",
        "dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
        "dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch",
        "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
        "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
        "dev:mp-xhs": "cross-env NODE_ENV=development UNI_PLATFORM=mp-xhs vue-cli-service uni-build --watch",
        "dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
        "dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
        "dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
        "dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
        "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
        "serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
        "test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
        "test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
        "test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
        "test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
        "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i",
        "prepare": "husky install",
        "eslint": "lint-staged",
        "lint": "eslint --fix --ext .js,.vue src"
    },
    "lint-staged": {
        "*.{js,vue}": [
            "eslint --ext .js,.vue"
        ]
    },
    "dependencies": {
        "@dcloudio/uni-app": "^2.0.2-3061720230112001",
        "@dcloudio/uni-app-plus": "^2.0.2-3061720230112001",
        "@dcloudio/uni-h5": "^2.0.2-3061720230112001",
        "@dcloudio/uni-i18n": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-360": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-alipay": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-baidu": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-jd": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-kuaishou": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-lark": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-qq": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-toutiao": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-vue": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-weixin": "^2.0.2-3061720230112001",
        "@dcloudio/uni-mp-xhs": "^2.0.2-3061720230112001",
        "@dcloudio/uni-quickapp-native": "^2.0.2-3061720230112001",
        "@dcloudio/uni-quickapp-webview": "^2.0.2-3061720230112001",
        "@dcloudio/uni-stacktracey": "^2.0.2-3061720230112001",
        "@dcloudio/uni-stat": "^2.0.2-3061720230112001",
        "@vant/weapp": "^1.10.13",
        "@vue/shared": "^3.0.0",
        "core-js": "^3.8.3",
        "flyio": "^0.6.2",
        "jsencrypt": "^3.2.1",
        "vue": ">= 2.6.14 < 2.7",
        "vuex": "^3.2.0"
    },
    "devDependencies": {
        "@dcloudio/types": "^3.0.4",
        "@dcloudio/uni-automator": "^2.0.2-3061720230112001",
        "@dcloudio/uni-cli-i18n": "^2.0.2-3061720230112001",
        "@dcloudio/uni-cli-shared": "^2.0.2-3061720230112001",
        "@dcloudio/uni-helper-json": "*",
        "@dcloudio/uni-migration": "^2.0.2-3061720230112001",
        "@dcloudio/uni-template-compiler": "^2.0.2-3061720230112001",
        "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.2-3061720230112001",
        "@dcloudio/vue-cli-plugin-uni": "^2.0.2-3061720230112001",
        "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.2-3061720230112001",
        "@dcloudio/webpack-uni-mp-loader": "^2.0.2-3061720230112001",
        "@dcloudio/webpack-uni-pages-loader": "^2.0.2-3061720230112001",
        "@vue/cli-plugin-babel": "~5.0.0",
        "@vue/cli-service": "~5.0.0",
        "@vue/eslint-config-prettier": "^6.0.0",
        "babel-eslint": "^10.1.0",
        "babel-plugin-import": "^1.11.0",
        "cross-env": "^7.0.2",
        "eslint": "^6.7.2",
        "eslint-plugin-prettier": "^3.3.1",
        "eslint-plugin-vue": "^6.2.2",
        "husky": "^8.0.0",
        "jest": "^25.4.0",
        "lint-staged": "^13.1.0",
        "mini-types": "*",
        "miniprogram-api-typings": "*",
        "node-sass": "^4.14.1",
        "postcss-comment": "^2.0.0",
        "prettier": "^2.2.1",
        "sass-loader": "^7.3.1",
        "sass-resources-loader": "^2.2.5",
        "vue-template-compiler": ">= 2.6.14 < 2.7"
    },
    "browserslist": [
        "Android >= 4.4",
        "ios >= 9"
    ],
    "uni-app": {
        "scripts": {}
    }
}
otizis commented 1 year ago

遇到了一样的问题,是要怎么配置?难道源码 自己手动加data-com-type="wx" ?