bailicangdu / vue2-happyfri Goto Github PK
View Code? Open in Web Editor NEWvue2 + vue-router + vuex 入门项目
License: MIT License
vue2 + vue-router + vuex 入门项目
License: MIT License
app.vue中只有一个router-view,在router中也没有引入item-container,那item-container是怎么引入进来的。router中配置‘/’指向app.vue,app.vue里啥也没有啊!
请问在根目录下有一个index.html 里面有这个,在App.vue这个文件里面也有也有这个,为什么这2个文件都要有这句,我看vue-cli的项目只有在App.vue里面才有。。麻烦解答下,谢谢
老师好,看了下ajax代码,如果是跨域的接口,该如何调用?
能解释一下路由里的这段代码吗?
build: {assetsSubDirectory: 'static', assetsPublicPath: '/happyfri/',}
and
build: {assetsSubDirectory: 'static', assetsPublicPath: './',}
都是no such file or directory :static/*
why?
根据您写的倒计时,想再页面中添加,老是不同步,还是初始值,能不能把这个功能实现了啊
答完题后,每次的得分都是20分,发现你在score/index.vue中的created()方法中给score赋值为20,难道不应该是前一个页面传过来,或者用vuex把score也当作状态来管理吗?
$ npm run dev
[email protected] dev I:\workspace\WebStorm\vue2-happyfri
node build/dev-server.js
module.js:538
throw err;
^
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (I:\workspace\WebStorm\vue2-happyfri\build\dev-server.js:5:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\FXBL-PC\AppData\Roaming\npm-cache_logs\2017-11-23T16_57_23_461Z-debug.log
http://operating-activities.putao.com/happyfriday?active_topic_id=3
{"httpStatusCode":301,"topiclist":[]}
POST http://localhost:8000/eus/v1/users/186655961/avatar 401 (Unauthorized)
_callee$ @ info.vue?8291:175
tryCatch @ runtime.js?1aab:65
invoke @ runtime.js?1aab:303
prototype.(anonymous function) @ runtime.js?1aab:117
step @ asyncToGenerator.js?74f6:17
(anonymous) @ asyncToGenerator.js?74f6:35
F @ _export.js?ece2:35
(anonymous) @ asyncToGenerator.js?74f6:14
uploadAvatar @ info.vue?8291:188
boundFn @ vue.common.js?e881:166
invoker @ vue.common.js?e881:1739
info.vue?8291:185 Uncaught (in promise) Error: TypeError: path.indexOf is not a function
at VueComponent._callee$ (eval at 202 (http://localhost:8000/15.info.js:90:2), :127:39)
at tryCatch (eval at (http://localhost:8000/app.js:1708:2), :65:40)
at Generator.invoke [as _invoke] (eval at (http://localhost:8000/app.js:1708:2), :303:22)
at Generator.prototype.(anonymous function) [as next] (eval at (http://localhost:8000/app.js:1708:2), :117:21)
at step (eval at (http://localhost:8000/app.js:706:2), :17:30)
at eval (eval at (http://localhost:8000/app.js:706:2), :28:13)
at
_callee$ @ info.vue?8291:185
tryCatch @ runtime.js?1aab:65
invoke @ runtime.js?1aab:303
prototype.(anonymous function) @ runtime.js?1aab:117
step @ asyncToGenerator.js?74f6:17
(anonymous) @ asyncToGenerator.js?74f6:28
初学者一枚,有些代码都不知道干啥的,为啥不写注释呢
新建了一个项目,同样在main中引入common.js,为什么在main.js 中 引入 import './assets/style/common.less' 出现如下报错信息:
This relative module was not found:
组件itemcontainer.vue里面的method 指向 ...mapActions([ 报错,是不是babel没有编译
打开页面后,并没有显示题目内容,只有选项可以选,????
点击效果展示404
不知道您的真实姓名是啥,加不了?方便的话麻烦加我QQ:957361614,共同探讨技术细节,谢谢!
传不了图片,抓包的时候 用POST请求 Form Data 里出现 {"phoneNum":"13545697852"}: 只有键 没有值。
是不是ajax.js有问题 或者我哪里写错了 望指点一下
npm run dev 运行时,会有
Module not found: Error: Cannot resolve module 'babel-runtime/helpers/typeof' in /home/me/WebstormProjects/vue2-happyfri/src/config
@ ./src/config/ajax.js 7:15-54
ERROR in ./src/config/ajax.js
Module not found: Error: Cannot resolve module 'babel-runtime/core-js/json/stringify' in /home/me/WebstormProjects/vue2-happyfri/src/config
@ ./src/config/ajax.js 11:17-64
ERROR in ./src/config/ajax.js
Module not found: Error: Cannot resolve module 'babel-runtime/core-js/object/keys' in /home/me/WebstormProjects/vue2-happyfri/src/config
@ ./src/config/ajax.js 15:12-56
ERROR in ./src/config/ajax.js
Module not found: Error: Cannot resolve module 'babel-runtime/core-js/promise' in /home/me/WebstormProjects/vue2-happyfri/src/config
@ ./src/config/ajax.js 19:15-55
ERROR in ./src/store/mutations.js
Module not found: Error: Cannot resolve module 'babel-runtime/helpers/defineProperty' in /home/me/WebstormProjects/vue2-happyfri/src/store
@ ./src/store/mutations.js 7:23-70
package.json依赖中缺少"babel-runtime"
我看你项目router目录下的路由的写法是
{
path: '/item',
component: r => require.ensure([], () => r(require('../page/item')), 'item')
},
而我看到的大多数路由的写法是
{
path: '/item',
component: item
}
感觉你这种写法比较复杂,为什么要这么复杂的写,这么写有什么好处呢?
从远程上down下项目,npm install -> npm run dev,
包都安装好了,但是浏览器无信息展示
@bailicangdu
演示地址不能用了
您好,我刚刚开始学VUE,看了这个项目后很困惑平时开发的时候到底该怎么跑起来调试,难道每次都编译发布?
你好,请问在main.js里面导入import './config/rem'
这个是怎么生效的呢?
因为我看到里面并没有export,vue实例化的时候是怎么使用得到这种导入的呢?谢谢
为什么在happyfri目录下有一个index.html,在根目录下也有一个index.html?有谁知道为什么吗?
刚开始学Vue,请教一下,不知道对不对。我看文档上说:
现在想象,我们正在 debug 一个 app 并且观察 devtool 中的 mutation 日志。每一条 mutation 被记录,devtools 都需要捕捉到前一状态和后一状态的快照。然而,在上面的例子中 mutation 中的异步函数中的回调让这不可能完成:因为当 mutation 触发的时候,回调函数还没有被调用,devtools 不知道什么时候回调函数实际上被调用——实质上任何在回调函数中进行的状态的改变都是不可追踪的;
您代码里记录做题时间有这样写:
/* 记录做题时间 */ [REMBER_TIME](state) { state.timer = setInterval(() => { state.allTime++; }, 1000) },
不知道这样有没有问题,请指教!
项目运行流程
大大,是我打开的方式不对吗?本人小白,刚接触vue,求解。
你好,我在仿写这个项目的时候遇到了一个问题。我尝试了很久都没能搞清楚问题的原因。
是这样的,我在模仿主页,在CSS和created
钩子函数插入资源的时候遇到了问题,无论怎么改变图片的路径,它都不会在页面上显示。控制台没有错误信息输出
我认为这是vue-loader
中的东西,于是查看了相关文档,但是文档上说有关.png
.jpg
的file-loader
已经集成在环境中了。有关代码已经上传至此处
另外,我还有个疑问想请教。在你给出的代码中第89行,为什么图片的路径是在static路径下,而源代码中不存在static这个文件夹。是当时的脚手架没有给出这个文件夹还是这个就是引入webpack
打包好之后的静态资源文件
我的Vue
和Vue-CLI
版本是2.9.1
,webpack
版本是3.6.0
非常感谢你的帮助
在你的基础上走完了vuex,把你记分的逻辑写完了。但是有点不好,我是用state里一个变量记录的,如果将分数页面直接复制出去,记分就失效了。这个记录分数的变量可以放在localStorage里面就可以消除这个问题
再次感谢
直接下载后
npm install后提示deprecate autoprefixer-loader@^3.2.0 ,deprecate babel-preset-es2015@^6.0.0
npm run dev 后有抛出错误
[email protected] dev C:\Users\gaof\Desktop\VUE\vue2-happyfri-master
node build/dev-server.js
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:8088
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1334:19)
at listenInCluster (net.js:1392:12)
at Server.listen (net.js:1476:7)
at Function.listen (C:\Users\gaof\Desktop\VUE\vue2-happyfri-master\node_modules_express@4.16.2@express\lib\application.js:618:24)
at Object. (C:\Users\gaof\Desktop\VUE\vue2-happyfri-master\build\dev-server.js:70:25)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\gaof\AppData\Roaming\npm-cache_logs\2017-12-19T07_46_57_968Z-debug.log
请问下这里是需要更新什么吗 新手表示没看懂错误,请大神解惑
rem.js是不是已经过时了?生产环境能用吗?
在那里配置 css单独引入 找不到你配的那个css config
npm run dev 之后浏览器没有反应,启动不了,怎么解决
$ npm install
npm WARN deprecated [email protected]: Please use postcss-loader instead of autoprefixer-loader
npm WARN deprecated [email protected]: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
样式是不是有问题啊?
感觉不是一个完整的项目,运行后和demo的完全不一样
谢谢!🙏 是我哪里出了吗,有谁能帮忙解答一下,想看下功能再下手联系,但是没有题目内容?
npm run build
[email protected] build G:\workplace\WebStorm\vue2-happyfri
node build/build.js
cp: no such file or directory: static/*
Hash: 279e8632ca3d04732614
Version: webpack 1.15.0
Time: 4519ms
Asset Size Chunks Chunk Names
static/js/home.abe9f43ebc69913271f5.min.js 29.2 kB 1, 3 [emitted] home
static/img/1-1.jpg 144 kB [emitted]
static/img/4-1.jpg 193 kB [emitted]
static/img/4-2.png 14.2 kB [emitted]
static/img/4-4.png 10.4 kB [emitted]
static/js/item.b0390b470966316eaf4e.min.js 29.2 kB 0, 3 [emitted] item
static/img/1-2.png 25.5 kB [emitted]
static/js/score.1bf2ac51530fa17b0b12.min.js 21.4 kB 2, 3 [emitted] score
static/js/manifest.js 962 bytes 3 [emitted] manifest
static/js/vendor.js 153 kB 4, 3 [emitted] vendor
static/js/app.js 6.25 kB 5, 3 [emitted] app
static/css/app.css 970 bytes 5, 3 [emitted] app
index.html 906 bytes [emitted]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.