Vue.js

vue 3 emit warning “ Extraneous non-emits event listeners”

我的未来我决定 提交于 2021-01-27 04:16:10
问题 I am trying to emit data from child to parent using the composition API I get the following warning. [Vue warn]: Extraneous non-emits event listeners (updatedcount) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.at <HelloWorld onUpdatedcount=fn > at childcomponent.vue <template> <h1>{{ store.count }}</h1>

Simulate select with element-ui and vue-test-utils

放肆的年华 提交于 2021-01-27 04:00:19
问题 I'm doing unit tests with Jest and Element-ui in Vue on a component which contains a select with 2 options. I am selecting an option from a dropdown and then checking that an action has been called. 1) With normal select and option HTML tags this works perfectly. // Fruit.vue <template lang="pug"> select( v-model="fruit" ) option( v-for="item in fruits" :label="item.label" :value="item.value" ) </template> <script> export default { data () { return { fruits: [ { label: 'Banana', value: false

Vue / Typescript, got Module '“*.vue”' has no exported member

核能气质少年 提交于 2021-01-27 03:57:21
问题 I want to export several interfaces together with Component from .vue file. Basic.vue: <template> <div class="app"> <router-view></router-view> </div> </template> <script lang="ts"> import { Vue, Component } from "vue-property-decorator"; export interface IBasic { name :string; } /** * Simplest container */ @Component export class Basic extends Vue {} export default Basic; </script> But when I import it from another .ts file, I got: What can I do to import the interface successfully? 回答1: You

Vue / Typescript, got Module '“*.vue”' has no exported member

a 夏天 提交于 2021-01-27 03:56:01
问题 I want to export several interfaces together with Component from .vue file. Basic.vue: <template> <div class="app"> <router-view></router-view> </div> </template> <script lang="ts"> import { Vue, Component } from "vue-property-decorator"; export interface IBasic { name :string; } /** * Simplest container */ @Component export class Basic extends Vue {} export default Basic; </script> But when I import it from another .ts file, I got: What can I do to import the interface successfully? 回答1: You

TypeError: Object(…) is not a function in Vue

别等时光非礼了梦想. 提交于 2021-01-26 13:17:40
问题 I am new to Vue and trying to handle form. I am making a web app to manage meetings and for this I have multi-step form which will handle visitor and host data. When I click submit button, I get following error:- TypeError: Object(...) is not a function . I searched for it on stackoverflow but couldn't get much clue. Following is my code:- scheduleMeeting.js <template> <el-container> <el-row> <el-col class="desc" :xs="24" :sm="24" :md="24" :lg="12" :xl="12"> <img src="../assets/meeting.svg"

TypeError: Object(…) is not a function in Vue

爱⌒轻易说出口 提交于 2021-01-26 13:13:28
问题 I am new to Vue and trying to handle form. I am making a web app to manage meetings and for this I have multi-step form which will handle visitor and host data. When I click submit button, I get following error:- TypeError: Object(...) is not a function . I searched for it on stackoverflow but couldn't get much clue. Following is my code:- scheduleMeeting.js <template> <el-container> <el-row> <el-col class="desc" :xs="24" :sm="24" :md="24" :lg="12" :xl="12"> <img src="../assets/meeting.svg"

第八十九周学习生活总结

烂漫一生 提交于 2021-01-26 11:59:51
  今天是2021年1月24日,这星期整体学习状况没有上星期的好,好几天没有按时起床打卡,或者是打了卡又回去睡觉了,不过昨天的状态不错,视频看了21集,感觉很充实,晚上去买零食吃都感觉很香。 Vue项目基础   前面两星期一直在看vue实战视频,看了两周了,感觉还不错,想快速落脚到我心心念念的在线考试系统上,毕竟跟着别人视频敲得代码实在是太水了,面试的时候一问就露馅了,所以我觉得还是得尽快转到在线考试系统的开发上。   这回大二重构在线考试系统,我想趁着这次大二的后端再来开发一次,希望这次我能很快的上手vue,之前写vue不成体系,压根都不知道去哪里添加,不过着两星期跟着别人的代码敲,现在感觉对vue的开发已经上道了。 来源: oschina 链接: https://my.oschina.net/u/4301169/blog/4925155

Vue-i18n - Cannot read property 'config' of undefined

自古美人都是妖i 提交于 2021-01-26 09:19:03
问题 First of all I show you what works (in App.js) import router from './routes.js'; import VueI18n from 'vue-i18n'; const messages = { en: { message: { hello: 'hello world' } } } // Create VueI18n instance with options const i18n = new VueI18n({ locale: 'en', // set locale messages, // set locale messages }) const app = new Vue({ el: '#app', router, i18n }); But if I want to separate the code in lang.js import VueI18n from 'vue-i18n'; const messages = { en: { message: { hello: 'hello world' } }

vue项目(webpack+mintui),使用hbuilder打包app

眉间皱痕 提交于 2021-01-26 09:09:54
一、配置config/index.js 本人没有配置index.js文件,就开始进行了打包,结果最终效果是页面空白,解决了空白,接着底部图标(我是用的阿里巴巴图片)资源找不到。所以配置这步比较重要。 (1)页面空白的解决: 打开config/index.js,将build模块的assetsPublicPath值改为’./’ assetsPublicPath: './', 发布路径 (2)css引用图片资源找不到问题: 因为打包后路径发生变化,导致这个图片就找不到。 stackflow上有一个解决办法,很简单打开“build/utils.js”,增加一行代码即可 publicPath:'../../'    二、通过webpack打包 执行这样命令后,可以看到根目录的dist文件夹下是打包好的静态资源 这样就打包好了,里面有index.html 以及 static文件夹(包含fonts、img、js、css文件夹)两个 三、使用hbuilder打开 将dist文件下拖动到huilder软件中即可 dist文件夹,就是拖动进去的,A 标记是app的意思,W是web的意思。我这里是已经转为app了,所以dist文件夹以 A 标识 ,没有转换之前是 W 标识 四、转换为移动APP 由于我已经转为APP,我用helloHBuilder做示范 右键需要转为app的文件夹,弹出的快捷菜单中——

HBuilder打包app(vue项目)

喜你入骨 提交于 2021-01-26 08:33:19
一、测试项目是否可以正确运行 指令:npm run dev 首先我们先建立一个vue的项目,本人用的是vue-cli随便建立的,然后运行项目 不必非得是像我这样的,这一步的目的只是测试一下咱们的vue项目是否可以运行 二、修改路径( assetsPublicPath: './' ) 打开我们config中的js文件,修改assetsPublicPath的路径为"./"(下图的右下角位置) 三、打包文件 指令:npm run build 打包后会生成dist文件 四、把dist文件变成app模式 在HBuilder中点击文件,打开目录,找到我们项目中的dist文件,确定。 然后我们会看到这样的带着 W 的文件 五、转换APP 右键dist,点击转换成App(T) 六、 在 manifest.json里面 配置APP名字及APP图标 我们在上一步会生成一个 manifest.json文件,打开它,我们在这里操作 app名字:就是应用名称(这里我写的是思源000) app图标:现在下面点击图标配置,然后选择图片放上去(图片只能为PNG格式,通过手动改后缀是不可以的),在这里我选择的是圣诞小人的图标 七、生成apk 1.点击发行,发行为原生安装包 2.点击使用DCloud公用证书,点击打包 好了打包成apk文件了,把这个安装到手机上咱们就可以用了,嘿嘿!!! 如果以上方法打包后还白屏