Tag Archives: View.js

Antdesignvue autocomplet completes the problem of repeated error reporting

If the data IDs are different, and there are multiple identical name values or multiple identical Title values, an error will be reported
just do it

    <a-auto-complete
      v-model="ruleForm.companyId"
        placeholder="Please Input"
        optionLabelProp="label"
        @select="onSelect"
        @change="onChangeStore"
      >
        <template slot="dataSource">
          <a-select-option
            v-for="item in dataSource"
            :key="item.id"
            :value="item.id + ''"
            :label="item.name"
          >
            {{ item.name }}
          </a-select-option>
        </template>
    </a-auto-complete>

Vue installation @ Vue/cli error: npmerr gyp err

At home on weekends, I want to install Vue on the local computer, but I always report the error of ‘gyp’. All kinds of Baidu attempts always fail until I see an explanation: installing @ Vue/cli reports the error npmerr gyp err
(intrusion and deletion)

Sort out:
1. First delete three Vue related files in the local folder directory C:// user/xxx/appdata/roaming/NPM
2. Switch the NPM image source of Taobao back to the initial image source of NPM:

https://registry.npmjs.org/
npm config set registry https://registry.npmjs.org/

Then run NPM install - G @ Vue/cli and wait.

[Solved] Syntax Error: TypeError: this.getOptions is not a function

Syntax Error: TypeError: this.getOptions is not a function

Scenario:

Error reporting when running Vue project

Error message:

Syntax Error: TypeError: this.getOptions is not a function

 @ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/article/article.vue?vue&type=style&index=0&id=53e7acee&lang=scss&scoped=true& 4:14-480 15:3-20:5 16:22-488
 @ ./src/pages/article/article.vue?vue&type=style&index=0&id=53e7acee&lang=scss&scoped=true&
 @ ./src/pages/article/article.vue
 @ ./src/router/config.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.3.101:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js babel-polyfill whatwg-fetch ./src/main.js

reason:

The probability is that the installed version of SCSS loader is too high

Solution:
uninstall the original too high version and install the lower version

npm uninstall --save sass-loader // uninstall
npm i -D [email protected] // install
npm uninstall --save node-sass //uninstall
npm i [email protected] // install

Vue project reports an error on ie11 white screen. Script1002: syntax error

Problem phenomenon

The project is a front-end project built with Vue/cli3 scaffold, and Vue version is 2.6.10.

Ie11 error reporting problems are as follows:

  (there was no screenshot in the error report at that time, but someone else’s picture was used)

 

It’s annoying that there’s no way to check mistakes like this

Baidu a pile, all copy to copy, the key has not been able to solve the problem, shit! Omnipotent Google up

  In fact, this problem is obviously a syntax error, that is, the problem that ie does not support, ie garbage

Since it’s a syntax problem, it’s a compilation problem. Let’s directly compile the corresponding package, but which package is it

Here’s the point: when you click the error message, you will find that the place where the breakpoint is is the place where the error is reported. That must be the problem here, but this is the compiled code. How to check which package is a headache!

When I was having a headache, I found that the comment above was the name of the package???

It’s like discovering a new world

It’s him. This picture is not my error information. My error information is

./node_modules/[email protected]@js-base64.js

Since the package with the problem is found, specify that it be compiled; Using webpack

Directly configure the compiled code in vue.config.js

transpileDependencies: [
    /[/\\]node_modules[/\\][email protected]@js-base64[/\\]/,
 ],

Then directly NPM run serve

be accomplished! It’s done! go off work!

The browser reported an error ‘stylesheets undefined’‘‘

Problem Description:

The browser reported an error of ‘stylesheets undefined’

this.sheetData.styleSheets = "";

Cause analysis:

In some scenarios, stylesheets do not exist, causing the browser to report an error and are not defined


Solution:

Add a judgment. If stylesheets does not exist, this attribute will be automatically added and null value will be assigned.

if (this.sheetData) {
      this.sheetData['styleSheets'] = "";
    }

After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme

1、 A blank page appears and an error is reported

        Scheme I:

                 1: The path of JS and CSS resources is incorrect

                 Solution: add assetspublicpath in config/index.js: ‘/’   Change to assetspublicpath: ‘. /’  

                 2: Error in background image in CSS

                 Solution: add a line of code in build/utils.js   publicPath:’../../’  

        Scheme 2: some people may create Vue basic projects through hbuilder. There are no files in scheme 1 in the directory. Then you can try the scheme at this time. It’s easy to use on my side. I’m not sure everyone is effective.

                Solution: create the vue.config.js file in the project root directory

 

  The contents of the document are as follows:

module.exports = {
    publicPath : './'
}

2、 Blank page, no resource error

        At this time, the problem may be caused by the routing mode

  history :

The new pushstate () and replacestate () methods in HTML5 history interface are utilized. (specific browser support is required) these two methods are applied to the browser’s history stack. On the basis of the existing back, forward and go, they provide the function of modifying the history. Only when they perform modification, although the current URL is changed, the browser will not immediately send a request to the back end.

Solution:

The default route of Vue is hash mode. You can modify it to hash. Or directly comment out mode: ‘history’,

Conclusion: the above is the relevant information I know. If any boss knows other questions, you can leave a message and learn together.

 

Vscode development Vue project eslint check error

When using vscode to develop Vue projects and eslint to check rules, V-for reports an error: expected ‘v-bind: key’ directives to use the viruses which are defined by the ‘V-for’ directive.
solution: define the index in the variable defined in V-for
example:

<div v-for="titile in titles" :key="title.index">{{ name }}</div>

Error: please renew the default configrations [How to Solve]

Please revert to the default configuration

When you are prompted to revert to the default configuration when configuring the switch, you need to delete the original configuration step by step and reconfigure the switch.
Reconfigure the switch, if you configure it directly, it will report an error

Example

Original configuration

port link-type access
port default vlan 500

The configuration that needs to be changed

interface GigabitEthernet0/0/28
undo port link-type  
undo port default vlan 500 
port link-type trunk 
 port trunk allow-pass vlan 2 to 4094

[Solved] Vuex state Error: [vuex] do not mutate vuex store state outside mutation handlers.

Vuex Error: [vuex] do not mutate vuex store state outside mutation handlers.

Error: [vuex] do not mutate vuex store state outside mutation handlers.

Error reason: the only way to change the status in vuex’s store is to submit mutation.

Vuex also provides a strict mode to control whether to prompt non-standard store value modification. After the strict mode is turned on, if the value is modified outside the mutation, it can also be dynamically rendered to the page, but Vue will have a warning prompt.

My usage scenario:

Vuex saves the data requested by the interface uniformly, and I call the interface in mutation to assign data to state.

solution:

The following reference official documents:

Mixing asynchronous calls in mutation will make your program difficult to debug. For example, when you call two mutation with asynchronous callbacks to change the state, how do you know when to call back and which to call back first?That’s why we have to distinguish between these two concepts. In vuex, mutation is a synchronous transaction

Asynchronous requests cannot be made in mutation. Asynchronous requests are placed in actions. Mutation must be a synchronous function!!

The test.js code example in the store file is as follows:

import * as types from './mutation-types';
import api from '../apis/orderList';
export const state = () => ({
  test: '111',
  defeatList: []
});

export const getters = {};

export const actions = {
  changeNum ({ commit }, Num) {
    commit('change_num', Num);
  },
  getDefeatList ({ commit }, params) {
    api.getDefeatList(params).then(res => {
      if (res && res.data) {
        let List = res.data;
        commit(types.GET_DEFEATLIST, List);
      }
    });
  }
};

export const mutations = {
  change_num (state, Num) {
    state.test = Num;
  },
  [types.GET_DEFEATLIST] (state, List) {
    state.defeatList = List;
  }
};

Component invocation:

<template>
	<a-table
		:columns="columns"
		:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
		:data-source="defeatList"
		:scroll="{ x: 1500 }"
		:pagination="paginationProps"
		:row-key="record => record.carNumber"
	 ></a-table>
</template>
computed: {
    test () {
      return this.$store.state.orderlist.test;
    },
    defeatList () {
      return this.$store.state.orderlist.defeatList;
    }
 },
methods: {
	initList () {
      let params = {
        pageNum: 1,
        ...this.form
      };
      this.$store.dispatch("test/getDefeatList", params); 
    },
}

Vue-element-admin Use npm install Error: npm ERR! Error while executing:

This post is about solving the error when installing dependencies on vue-element-admin.
When using npm install to download dependencies, the first problem I encountered was as follows.

npm ERR! Error while executing:
npm ERR! D:\git\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR!
npm ERR! fatal: unable to access ‘https://github.com/nhn/raphael.git/’: OpenSSL SSL_read: Connection was reset, errno 10054
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\new\AppData\Roaming\npm-cache_logs\2021-09-08T01_40_03_853Z-debug.log

This is a bad network, you can change a network and then re-download the dependency, I re-downloaded after changing the network, and encountered another kind of error, as follows.

npm ERR! Error while executing:
npm ERR! D:\git\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR!
npm ERR! fatal: unable to access ‘https://github.com/nhn/raphael.git/’: Failed to connect to github.com port 443: Timed out
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\new\AppData\Roaming\npm-cache_logs\2021-09-08T01_23_18_405Z-debug.log

This problem can be solved by executing directly from the terminal.

git config –global url.“https://”.insteadOf git://

After execution, download the dependency again, and it will download normally