Skip to content

Instantly share code, notes, and snippets.

<template>
<div>
还剩{{balance}}
<button @click="handleClick">我要花我爷爷给我的钱</button>
</div>
</template>
<script>
export default {
inject: ['eventBus'],
const mongoose = require('mongoose')
// ES6
mongoose.Promise = global.Promise
// Connect to the db before tests run
before(done => {
// Connect to mongodb
mongoose.connect('mongodb://localhost/testaroo', {
useNewUrlParser: true,
@crazyones110
crazyones110 / current.vue
Created February 3, 2020 10:27
创建的时候如何判断时候已经存在了,然后创建新的 保证环境中只有一个,不能有多个
<script>
export default {
data() {
return {
currentDiv: null
}
},
methods: {
createDiv() {
if (!this.currentDiv) {
this.$nextTick(() => {
this.$refs.line.style.height = getComputedStyle(this.$refs.wrapper).height
})
const env = process.env.NODE_ENV // 环境参数,是在 npm script 里设置的
let MYSQL_CONF
let REDIS_CONF
if (env === "dev") {
// mysql
MYSQL_CONF = {
host: "localhost",
user: "root",