小编Jay*_*n H的帖子

'import'和'export'可能只出现在顶层

我正在使用带有vuejs的webpack.Webpack做了它的事情,但是当我查看输出的app.js文件时,它给了我这个错误.

'import'和'export'可能只出现在顶层

我假设babel没有转换代码是个问题?因为我在查看应用程序时在浏览器中收到此信息.

意外的令牌导入

这是我的vuejs应用程序的entry.js:

/*jshint esversion: 6 */
import Vue from 'vue';
import App from './App.vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
require('./css/style.scss');

// Export the vue router
export var router = new VueRouter({
  hashbang: false,
  root: '/'
  // history: true
});

// Set up routing and match routes to components
router.map({
  '/': {
    component: require('./components/home/Home.vue')
  }
});

// Redirect to the home route if any routes are unmatched
router.redirect({
  '*': '/'
});

// Start the app on the #app …
Run Code Online (Sandbox Code Playgroud)

webpack vue.js babeljs

40
推荐指数
7
解决办法
7万
查看次数

MySQL安装程序陷入"启动服务"

我最近使用Windows Server 2012 R2上的MySQL安装程序成功安装了MySQL 5.6.21.我需要做一些修改并尝试重新安装.

现在MySQL挂在"启动服务"上.

在此输入图像描述

我尝试过以下方法:

  • 使用控制面板卸载
  • 使用"sc delete MySQL56"删除服务
  • 从"Program Files"和"c:\ programdata"中删除所有MySQL文件

有没有人见过这个问题?如果是这样,你怎么能解决它?

mysql install

16
推荐指数
2
解决办法
4万
查看次数

计算属性中的Vuex getter在完整页面加载之前显示未定义

我正在尝试使用在vuex中使用mapGetters函数提取的数据来创建计算属性,但我总是未定义,直到页面/ dom完全加载.

这是一个用于隐藏/显示某些按钮的isRegistered computed属性的示例.

computed: {
      ...mapGetters(['solos', 'user']),
      isRegistered () {
        return this.solos.registered.indexOf(this.user._id) !== -1
      }
}
Run Code Online (Sandbox Code Playgroud)

以下是使用isRegistered computed属性的按钮的HTML.

<a href="#" class="register-button" v-if="!isRegistered">REGISTER NOW</a>
<a href="#" class="registered-button" v-if="isRegistered">REGISTERED</a>
Run Code Online (Sandbox Code Playgroud)

我正在通过我在创建的函数中调用的动作设置getter

created () {
      this.getTournament('solos').catch(err => {})
}
Run Code Online (Sandbox Code Playgroud)

这是我设置相应getter的操作

getTournament: ({commit}, type) => {
    return feathers.service('tournaments').find({
      query: {
        type: type,
        status: 'registering'
      }
    }).then(tourney => {
      commit(type.toUpperCase(), tourney.data[0])
    })
}
Run Code Online (Sandbox Code Playgroud)

这是相应的突变

const mutations = {
  SOLOS (state, result) {
    state.solos = result;
  }
};
Run Code Online (Sandbox Code Playgroud)

这是相应的吸气剂

const getters = {
   solos (state) { …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuex

9
推荐指数
1
解决办法
3976
查看次数

Vuex和VueJS(不要在突变处理程序之外改变vuex存储状态)

我试图创建一个listenAuth会监视"功能onAuthStateChanged "在火力通知vuex店当用户登录或退出.据我所知,我只是使用变异处理程序修改state.authData,除非我遗漏了什么?

我收到错误:

[vuex] Do not mutate vuex store state outside mutation handlers.
Run Code Online (Sandbox Code Playgroud)

这是我的App.vue javascript(来自我的组件)

<script>
// import Navigation from './components/Navigation'
import * as actions from './vuex/actions'
import store from './vuex/store'
import firebase from 'firebase/app'

export default {
  store,
  ready: function () {
    this.listenAuth()
  },
  vuex: {
    actions,
    getters: {
      authData: state => state.authData,
      user: state => state.user
    }
  },
  components: {
    // Navigation
  },
  watch: {
    authData (val) {
      if (!val) { …
Run Code Online (Sandbox Code Playgroud)

javascript firebase vue.js firebase-authentication vuex

8
推荐指数
2
解决办法
5662
查看次数