Vue.js

Command not found

我只是一个虾纸丫 提交于 2021-02-10 16:05:48
问题 Been struggling to get my first vue project started and was looking for some help. I have both npm and node updated on my system but continually keep falling to the same issue. My steps: 1.) npm install Terminal Response: npm WARN mbasile@1.0.0 No description up to date in 0.095s 2.) npm install vue Terminal Response: npm WARN mbasile@1.0.0 No description + vue@2.5.16 updated 1 package in 0.951s Here's where things get funky? 3.) npm install -g @vue/cli Terminal Response: npm ERR! path /Users

Access to a function\$refs in another component not in the same level as current one

杀马特。学长 韩版系。学妹 提交于 2021-02-10 15:52:06
问题 I've a Vue 2 application, with different components nested. Their structure is kinda (I'm skipping the not-relevant ones for my question): <root> <app> <component1/> ... <component3> <billingAddress> <customForm/> </billingAddress> <shippingAddress> <customForm/> </shippingAddress> </component3> ... <lastComponent/> </app> </root> The customForm1 and 2 contain a form, validated via vee-validate - so there' a ValidationObserver component. Those two forms are validated at the relative submit -

Access to a function\$refs in another component not in the same level as current one

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-10 15:49:39
问题 I've a Vue 2 application, with different components nested. Their structure is kinda (I'm skipping the not-relevant ones for my question): <root> <app> <component1/> ... <component3> <billingAddress> <customForm/> </billingAddress> <shippingAddress> <customForm/> </shippingAddress> </component3> ... <lastComponent/> </app> </root> The customForm1 and 2 contain a form, validated via vee-validate - so there' a ValidationObserver component. Those two forms are validated at the relative submit -

Computed property not updating on props changes

 ̄綄美尐妖づ 提交于 2021-02-10 15:39:15
问题 I can't get a computed property to update, when a nested property in a passed prop object is changed. this.favourite is passed via props, but the computed property is not updating when this.favourite.selectedChoices.second.id and this.favourite.selectedChoices.first.id is changed. Any ideas of how to make this reactive? Here's the computed property: isDisabled() { const hasMultipleChoices = this.favourite.choices.length ? this.favourite.choices[0].value.some(value => value.choices.length) :

how to switch locale with storybook in vue js project via the @storybook/addon-contexts

帅比萌擦擦* 提交于 2021-02-10 15:00:55
问题 I m looking for a sample to be able to switch locale from vue-i18n inside storybook. I have find this addon-context story on the official storybook github but i have some difficulties to make works. I m using storybook v5.3, vue.js v2.6 and vue-i18n v8.15.4. For the moment, i have the globe icon with 2 entries (english and french). But when i switch it has no effect on the vue-i18n locale. // .storybook/main.js module.exports = { stories: ["../../src/**/*.stories.(js|jsx|ts|tsx|mdx)"], addons

webpack configuration: remove hash from *.js entry/bundle files names

一曲冷凌霜 提交于 2021-02-10 14:51:43
问题 I am doing a vue.js app. After build it generate a js file "background.2a548437.js" instead of the "background.js" that I want. I'm doing the webpack-chain configuration through the "vue.config.js" file. To diagnose, I'm reading the result of "$vue inspect", but I don't see which parameter should I tune to remove the hash from the js files. I do see patterns like 'img/[name].[hash:8].[ext]' but for js it's 'js/[name].js' Do you have any solutions or leads ? Context/Why: It uses webpack "^4.0

Get {“message”:“Unauthenticated.”} when sending POST request to laravel server

独自空忆成欢 提交于 2021-02-10 14:48:22
问题 I have a problem with sending POST request from Vue axios to laravel server with sanctum. Firstly I'm getting token. My route of api.php Route::post('/get_token', function (Request $request) { $request->validate([ 'email' => 'required|email', 'password' => 'required', 'device_name' => 'required' ]); $user = User::where('email', $request->email)->first(); if (! $user || ! Hash::check($request->password, $user->password)) { throw ValidationException::withMessages([ 'email' => ['The provided

Get {“message”:“Unauthenticated.”} when sending POST request to laravel server

試著忘記壹切 提交于 2021-02-10 14:47:22
问题 I have a problem with sending POST request from Vue axios to laravel server with sanctum. Firstly I'm getting token. My route of api.php Route::post('/get_token', function (Request $request) { $request->validate([ 'email' => 'required|email', 'password' => 'required', 'device_name' => 'required' ]); $user = User::where('email', $request->email)->first(); if (! $user || ! Hash::check($request->password, $user->password)) { throw ValidationException::withMessages([ 'email' => ['The provided

How to loop over nested array in vue and display data every 5 seconds?

你离开我真会死。 提交于 2021-02-10 14:44:40
问题 I'm using Vue Js and I have a nested array like this: arrays: [ { name: 'Max', Info: [60, 75, 70, 85, 65], }, { name: 'Dave, Info: [70, 95, 60, 65, 83], }, ] I have a user profile box that displays name and info for each user. <div class="outer" v-for="(item, index) in arrays" :key="item.id" v-bind:id="item.name"> I would like to display info in template: <div class="box c" >Info<span v-for="info in item.Info">{{info}}</span></div> When I did this it showed the correct array for the correct

使用lodop.js打印控件打印table并分页等

孤者浪人 提交于 2021-02-10 14:42:21
import {getLodop} from '@/utils/LodopFuncs.js' // 打印表格 export default { // num 打印还是打印预览 conData 对象形式 传入需要的值 自定义 (自己添加的属性要在下面备注) // conData title 标题 OrgName科室名字 lodopTable: function (num,conData){ // 原始table var table = document.getElementsByClassName("tablePrin")[0 ] var thead = table.getElementsByTagName("thead")[0 ] var tbody = table.getElementsByTagName("tbody")[0 ] var clnThead = thead.cloneNode( true ) var clnTbody = tbody.cloneNode( true ) document.getElementsByClassName( "colneTable")[0 ].appendChild(clnThead) document.getElementsByClassName( "colneTable")[0 ].appendChild(clnTbody) var