Coder Social home page Coder Social logo

vue-vuex-typescript-demo's Issues

npm run dev has errors

10% building modules 1/1 modules 0 activeevents.js:160
throw er; // Unhandled 'error' event
^

Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

think a lot,but don`t solve ,please help,thx

启动时为什么有警告?

克隆并安装依赖完成( cnpm i )后,
npm run dev
报警告如下:

[email protected] dev D:\Music\vue-vuex-typescript-demo
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

10% building modules 7/10 modules 3 active ...es_webpack@3.10.0@webpack\hot\log.jsWarning: The 'await-promise' rule requires type information.
Warning: The 'no-unused-variable' rule requires type information.
Warning: The 'no-use-before-declare' rule requires type information.
Warning: The 'return-undefined' rule requires type information.
Warning: The 'no-floating-promises' rule requires type information.
Warning: The 'no-unnecessary-qualifier' rule requires type information.
Warning: The 'no-unnecessary-type-assertion' rule requires type information.
Warning: The 'strict-type-predicates' rule requires type information. 95% emitting DONE Compiled successfully in 18156ms17:08:54
I Your application is running here: http://localhost:8081

求大神帮忙

我最近在重构一个以前做完的vue2.5项目,这次想使用ts。先自己创建了一个demo,但是改成ts后就报了很多错,弄了好长时间,改了一部分,但是还是不行。
这是项目地址:https://github.com/Dadaven/-1
:)

Getter 如何做到提示?

请问,在组件中使用 this.$store.getters 如何能做到自动提示和类型安全呢?我的 VSCode 好像并不能通过点运算符联想到 getters 上面的值,手写的值类型也只是 any.

main.ts引入图片的问题

# 图片懒加载的时候需要在main.ts引入图片
Vue.use(vueLazyload, {
    loading: 'xxxx.png'
})

import './common/image/default.png' 可以引用到图片

但没法赋值。 比如说

import loadingImage from './common/image/default.png'

此时vscode就会报找不到模块

请问楼主是怎么解决这个问题的?

Vue.use(vueLazyload, {
    loading: import './common/image/default.png'
})

这种方式也不行。

这个项目对我收益匪浅,感谢。初学ts,碰到很多坑。

Property [*] has no initializer and is not definitely assigned in the constructor

启动后提示

TS2564: Property 'products' has no initializer and is not definitely assigned in the constructor.
TS2564: Property 'checkoutStatus' has no initializer and is not definitely assigned in the constructor.
TS2564: Property 'actionCheckout' has no initializer and is not definitely assigned in the constructor.

原因是 TS 2.7 默认开启 strictPropertyInitialization
添加 "strictPropertyInitialization": falsetsconfig.json
或者指定 TS 版本为 2.6.1

如何引入mint-ui?

[ts]
无法找到模块“mint-ui”的声明文件。“g:/node/vue-vuex-typescript-demo/node_modules/mint-ui/lib/mint-ui.common.js”隐式拥有 "any" 类型。
尝试 "npm install @types/mint-ui" (如果存在),或者添加一个包含“声明模块‘mint-ui’”的新声明文件(.d.ts);

已解决!在vue-shim.d.ts中添加 declare module 'mint-ui'声明即可!

求教

运行之后
Module build failed: TypeError: Cannot set property 'tsLoaderDefinitionFileVersions' of undefined
at getEmit (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/index.js:202:61)
at successLoader (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/index.js:34:11)
at Object.loader (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/index.js:21:12)

@ multi ./node_modules/_webpack-dev-server@2.11.2@webpack-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.ts

这个报错是为什么呢?网上也搜不到。

还有就是报一个
Module build failed: TypeError: Cannot read property 'afterCompile' of undefined
at successfulTypeScriptInstance (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/instances.js:147:27)
at Object.getTypeScriptInstance (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/instances.js:48:12)
at Object.loader (/Users/denglingbo/vue-project/tsvue-demo/node_modules/_ts-loader@4.0.1@ts-loader/dist/index.js:16:41)

@ multi ./node_modules/_webpack-dev-server@2.11.2@webpack-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.ts

在网上也查不到,根据配置来的,希望得到帮助

启动后报错

运行npm run serve后,会出现以下错误:
Error: Cannot find module 'typescript/package.json'
Error: Cannot find module 'typescript/package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at api.chainWebpack.config (D:\git-program\vue-vuex-typescript-demo\node_modules_@[email protected]@@VUE\cli-plugin-typescript\index.js:29:23)
at webpackChainFns.forEach.fn (D:\git-program\vue-vuex-typescript-demo\node_modules_@[email protected]@@VUE\cli-service\lib\Service.js:209:40)
到底是什么问题?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.