refactor: update eslint-config to 1.x

Co-authored-by: Alexander Lichter <manniL@gmx.net>
This commit is contained in:
pooya parsa 2019-07-10 15:15:49 +04:30
parent 1e65e638c4
commit e7cc2757c3
289 changed files with 831 additions and 742 deletions

View File

@ -1,4 +1,4 @@
function isBabelLoader(caller) {
function isBabelLoader (caller) {
return caller && caller.name === 'babel-loader'
}

View File

@ -1,7 +1,7 @@
export default {
build: true,
hooks: {
async 'build:done'(pkg) {
async 'build:done' (pkg) {
const mono = pkg.load('../..')
const nuxt = pkg.load('../nuxt')

View File

@ -1,7 +1,7 @@
export default {
build: false,
hooks: {
async 'build:done'(pkg) {
async 'build:done' (pkg) {
const mono = pkg.load('../..')
const nuxt = pkg.load('../nuxt')

View File

@ -1,7 +1,7 @@
export default {
build: true,
hooks: {
async 'build:done'(pkg) {
async 'build:done' (pkg) {
const mono = pkg.load('../..')
await pkg.copyFilesFrom(mono, [

View File

@ -12,7 +12,7 @@ const getPost = slug => ({
})
export default {
beforeCreate() {
beforeCreate () {
this.component = () => getPost(this.$route.params.slug)
}
}

View File

@ -15,12 +15,12 @@
import axios from 'axios'
export default {
async asyncData({ params }) {
async asyncData ({ params }) {
// We can use async/await ES6 feature
const { data } = await axios.get(`https://jsonplaceholder.typicode.com/posts/${params.id}`)
return { post: data }
},
head() {
head () {
return {
title: this.post.title
}

View File

@ -21,7 +21,7 @@
import axios from 'axios'
export default {
asyncData({ req, params }) {
asyncData ({ req, params }) {
// We can return a Promise instead of calling the callback
return axios.get('https://jsonplaceholder.typicode.com/posts')
.then((res) => {

View File

@ -25,7 +25,7 @@ const Cookie = process.client ? require('js-cookie') : undefined
export default {
methods: {
logout() {
logout () {
Cookie.remove('auth')
this.$store.commit('setAuth', null)
}

View File

@ -22,7 +22,7 @@ const Cookie = process.client ? require('js-cookie') : undefined
export default {
middleware: 'notAuthenticated',
methods: {
postLogin() {
postLogin () {
setTimeout(() => { // we simulate the async request with timeout.
const auth = {
accessToken: 'someStringGotFromApiServiceWithAjax'

View File

@ -6,12 +6,12 @@ export const state = () => {
}
}
export const mutations = {
setAuth(state, auth) {
setAuth (state, auth) {
state.auth = auth
}
}
export const actions = {
nuxtServerInit({ commit }, { req }) {
nuxtServerInit ({ commit }, { req }) {
let auth = null
if (req.headers.cookie) {
const parsed = cookieparser.parse(req.headers.cookie)

View File

@ -30,7 +30,7 @@
<script>
export default {
data() {
data () {
return {
formError: null,
formUsername: '',
@ -38,7 +38,7 @@ export default {
}
},
methods: {
async login() {
async login () {
try {
await this.$store.dispatch('login', {
username: this.formUsername,
@ -51,7 +51,7 @@ export default {
this.formError = e.message
}
},
async logout() {
async logout () {
try {
await this.$store.dispatch('logout')
} catch (e) {

View File

@ -5,19 +5,19 @@ export const state = () => ({
})
export const mutations = {
SET_USER: function (state, user) {
SET_USER (state, user) {
state.authUser = user
}
}
export const actions = {
// nuxtServerInit is called by Nuxt.js before server-rendering every page
nuxtServerInit({ commit }, { req }) {
nuxtServerInit ({ commit }, { req }) {
if (req.session && req.session.authUser) {
commit('SET_USER', req.session.authUser)
}
},
async login({ commit }, { username, password }) {
async login ({ commit }, { username, password }) {
try {
const { data } = await axios.post('/api/login', { username, password })
commit('SET_USER', data)
@ -29,7 +29,7 @@ export const actions = {
}
},
async logout({ commit }) {
async logout ({ commit }) {
await axios.post('/api/logout')
commit('SET_USER', null)
}

View File

@ -9,7 +9,7 @@
export default {
async asyncData({ app }) {
async asyncData ({ app }) {
const { data: { message: dog } } = await app.$axios.get('/dog')
return { dog }
}

View File

@ -9,11 +9,11 @@
<script>
export default {
name: 'Date',
serverCacheKey() {
serverCacheKey () {
// Will change every 10 secondes
return Math.floor(Date.now() / 10000)
},
data() {
data () {
return { date: Date.now() }
}
}

View File

@ -10,7 +10,7 @@ export default function () {
// Add CoffeeScruot loader
config.module.rules.push(coffeeLoader)
// Add .coffee extension in webpack resolve
if (config.resolve.extensions.indexOf('.coffee') === -1) {
if (!config.resolve.extensions.includes('.coffee')) {
config.resolve.extensions.push('.coffee')
}
})

View File

@ -5,7 +5,7 @@ export default {
manifest: 'manifest.[hash].js', // default: manifest.[hash].js
app: 'app.[chunkhash].js' // default: nuxt.bundle.[chunkhash].js
},
extend(config, { isDev }) {
extend (config, { isDev }) {
if (isDev) {
config.devtool = 'eval-source-map'
}

View File

@ -10,7 +10,7 @@
<script>
export default {
layout: 'dark',
asyncData({ req }) {
asyncData ({ req }) {
return {
name: req ? 'server' : 'client'
}

View File

@ -10,10 +10,10 @@ export default {
loading: false
}),
methods: {
start() {
start () {
this.loading = true
},
finish() {
finish () {
this.loading = false
}
}

View File

@ -9,7 +9,7 @@
<script>
export default {
asyncData() {
asyncData () {
return new Promise((resolve) => {
setTimeout(function () {
resolve({})

View File

@ -9,7 +9,7 @@
<script>
export default {
asyncData() {
asyncData () {
return new Promise((resolve) => {
setTimeout(function () {
resolve({ name: 'world' })

View File

@ -14,21 +14,21 @@
<script>
export default {
loading: false,
asyncData() {
asyncData () {
return new Promise((resolve) => {
setTimeout(function () {
resolve({})
}, 1000)
})
},
mounted() {
mounted () {
setTimeout(() => {
// Extend loader for an additional 5s
this.$nuxt.$loading.finish()
}, 5000)
},
methods: {
goToFinal() {
goToFinal () {
// Start loader immediately
this.$nuxt.$loading.start()
// Actually change route 5s later

View File

@ -9,7 +9,7 @@
<script>
export default {
asyncData() {
asyncData () {
return new Promise((resolve) => {
setTimeout(function () {
resolve({ name: 'world' })

View File

@ -15,7 +15,7 @@
import axios from 'axios'
export default {
async asyncData() {
async asyncData () {
const { data } = await axios.get('https://jsonplaceholder.typicode.com/users')
return { users: data }
}

View File

@ -15,10 +15,10 @@
import axios from 'axios'
export default {
validate({ params }) {
validate ({ params }) {
return !isNaN(+params.id)
},
async asyncData({ params, error }) {
async asyncData ({ params, error }) {
try {
const { data } = await axios.get(`https://jsonplaceholder.typicode.com/users/${+params.id}`)
return data

View File

@ -48,7 +48,7 @@ export default {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
extend (config, ctx) {
}
}
}

View File

@ -3,7 +3,7 @@ import { Bar } from 'vue-chartjs'
export default {
extends: Bar,
props: ['data'],
mounted() {
mounted () {
this.renderChart(this.data)
}
}

View File

@ -46,7 +46,7 @@ export default {
data: () => ({
loaded: false
}),
beforeMount() {
beforeMount () {
// Preload image
const img = new Image()
img.onload = () => {

View File

@ -18,8 +18,8 @@ export const messages = [
{ component: 'vText', data: 'End of demo 🎉' }
]
async function streamMessages(fn, i = 0) {
if (i >= messages.length) return
async function streamMessages (fn, i = 0) {
if (i >= messages.length) { return }
await fn(messages[i])
setTimeout(() => streamMessages(fn, i + 1), 1500)
}

View File

@ -24,7 +24,7 @@ export default {
data: () => ({
messages: []
}),
mounted() {
mounted () {
// Listen for incoming messages
streamMessages(async (message) => {
// Wait for the component to load before displaying it

View File

@ -10,7 +10,7 @@
<script>
export default {
layout: ({ isMobile }) => isMobile ? 'mobile' : 'default',
asyncData({ req }) {
asyncData ({ req }) {
return {
name: req ? 'server' : 'client'
}

View File

@ -9,7 +9,7 @@
<script>
export default {
asyncData() {
asyncData () {
return {
name: process.static ? 'static' : (process.server ? 'server' : 'client')
}

View File

@ -1,10 +1,10 @@
export default function ({ isHMR, app, store, route, params, error, redirect }) {
const defaultLocale = app.i18n.fallbackLocale
// If middleware is called from hot module replacement, ignore it
if (isHMR) return
if (isHMR) { return }
// Get locale from params
const locale = params.lang || defaultLocale
if (store.state.locales.indexOf(locale) === -1) {
if (!store.state.locales.includes(locale)) {
return error({ message: 'This page could not be found.', statusCode: 404 })
}
// Set locale

View File

@ -11,7 +11,7 @@
<script>
export default {
head() {
head () {
return { title: this.$t('about.title') }
}
}

View File

@ -11,7 +11,7 @@
<script>
export default {
head() {
head () {
return { title: this.$t('home.title') }
}
}

View File

@ -4,8 +4,8 @@ export const state = () => ({
})
export const mutations = {
SET_LANG(state, locale) {
if (state.locales.indexOf(locale) !== -1) {
SET_LANG (state, locale) {
if (state.locales.includes(locale)) {
state.locale = locale
}
}

View File

@ -11,7 +11,7 @@
<script>
export default {
asyncData() {
asyncData () {
return {
name: process.static ? 'static' : (process.server ? 'server' : 'client')
}

View File

@ -17,7 +17,7 @@ export default {
clicked: false
}),
methods: {
handleClick() {
handleClick () {
this.clicked = true
}
}

View File

@ -11,7 +11,7 @@ export default {
components: {
Test
},
render() {
render () {
return <div class='container'>
<h1>About page</h1>
<test data='I am test component' />

View File

@ -11,7 +11,7 @@ export default {
{ src: '/defer.js', defer: '' }
]
},
render() {
render () {
return <div class='container'>
<h1>Home page 🚀</h1>
<NuxtLink to='/about'>About page</NuxtLink>

View File

@ -33,13 +33,13 @@
import axios from 'axios'
export default {
data() {
data () {
return {
transitionName: this.getTransitionName(this.page)
}
},
watch: {
'$route.query.page': async function (page) {
async '$route.query.page' (page) {
this.$nuxt.$loading.start()
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
this.users = data.data
@ -49,7 +49,7 @@ export default {
this.$nuxt.$loading.finish()
}
},
async asyncData({ query }) {
async asyncData ({ query }) {
const page = +(query.page || 1)
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
return {
@ -59,7 +59,7 @@ export default {
}
},
methods: {
getTransitionName(newPage) {
getTransitionName (newPage) {
return newPage < this.page ? 'slide-right' : 'slide-left'
}
},

View File

@ -36,11 +36,11 @@ export default {
// Key for <NuxtChild> (transitions)
key: to => to.fullPath,
// Called to know which transition to apply
transition(to, from) {
if (!from) return 'slide-left'
transition (to, from) {
if (!from) { return 'slide-left' }
return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left'
},
async asyncData({ query }) {
async asyncData ({ query }) {
const page = +(query.page || 1)
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
return {

View File

@ -10,7 +10,7 @@
<script>
export default {
data() {
data () {
return {
model: 'I am index'
}

View File

@ -11,7 +11,7 @@
<script>
export default {
data() {
data () {
return {
model: '## Title h2\n### title h3\n\nLong text Long text Long text Long text Long text Long text Long text Long text Long text \n\n* gimme a list item\n* and one more yeehaw'
}

View File

@ -9,12 +9,12 @@
<script>
export default {
filters: {
hours(date) {
hours (date) {
return date.split('T')[1].split('.')[0]
}
},
computed: {
visits() {
visits () {
return this.$store.state.visits.slice().reverse()
}
}

View File

@ -19,7 +19,7 @@
<script>
export default {
asyncData({ store, route, userAgent }) {
asyncData ({ store, route, userAgent }) {
return {
userAgent,
slugs: [

View File

@ -3,7 +3,7 @@ export const state = () => ({
})
export const mutations = {
ADD_VISIT(state, path) {
ADD_VISIT (state, path) {
state.visits.push({
path,
date: new Date().toJSON()

View File

@ -1,6 +1,6 @@
export default {
router: {
extendRoutes(routes, resolve) {
extendRoutes (routes, resolve) {
const indexIndex = routes.findIndex(route => route.name === 'index')
let index = routes[indexIndex].children.findIndex(route => route.name === 'index-child-id')
routes[indexIndex].children[index] = {

View File

@ -8,11 +8,11 @@
<script>
export default {
name: 'Child',
validate({ params }) {
validate ({ params }) {
return !isNaN(+params.id)
},
computed: {
id() {
id () {
return this.$route.params.id
}
}

View File

@ -22,7 +22,7 @@
<script>
export default {
asyncData({ env }) {
asyncData ({ env }) {
return { users: env.users }
}
}

View File

@ -7,17 +7,17 @@
<script>
export default {
validate({ params }) {
validate ({ params }) {
return !isNaN(+params.id)
},
asyncData({ params, env, error }) {
asyncData ({ params, env, error }) {
const user = env.users.find(user => String(user.id) === params.id)
if (!user) {
return error({ message: 'User not found', statusCode: 404 })
}
return user
},
head() {
head () {
return {
title: this.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -8,7 +8,7 @@
<script>
export default {
head() {
head () {
return {
title: this.$route.name
}

View File

@ -13,7 +13,7 @@
import axios from 'axios'
export default {
asyncData() {
asyncData () {
const nb = Math.max(1, Math.round(Math.random() * 10))
return axios.get(`https://jsonplaceholder.typicode.com/photos/${nb}`).then(res => res.data)
}

View File

@ -20,7 +20,7 @@ if (process.client) {
}
export default {
mounted() {
mounted () {
miniToastr.init()
},
notifications: {

View File

@ -6,7 +6,7 @@
<script>
export default {
asyncData() {
asyncData () {
return {
name: process.static ? 'static' : (process.server ? 'server' : 'client')
}

View File

@ -3,7 +3,7 @@ export const state = () => ({
})
export const mutations = {
SET_THEME(state, theme) {
SET_THEME (state, theme) {
state.theme = theme
}
}

View File

@ -34,11 +34,11 @@ export default {
// Key for <NuxtChild> (transitions)
key: to => to.fullPath,
// Called to know which transition to apply
transition(to, from) {
if (!from) return 'slide-left'
transition (to, from) {
if (!from) { return 'slide-left' }
return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left'
},
async asyncData({ query }) {
async asyncData ({ query }) {
const page = +query.page || 1
const data = await fetch(`https://reqres.in/api/users?page=${page}`).then(res => res.json())

View File

@ -35,11 +35,11 @@ export default {
// Key for <NuxtChild> (transitions)
key: to => to.fullPath,
// Called to know which transition to apply
transition(to, from) {
if (!from) return 'slide-left'
transition (to, from) {
if (!from) { return 'slide-left' }
return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left'
},
async asyncData({ query, $axios }) {
async asyncData ({ query, $axios }) {
const page = +query.page || 1
const data = await $axios.$get(`https://reqres.in/api/users?page=${page}`)
return {

View File

@ -9,7 +9,7 @@
<script>
export default {
asyncData() {
asyncData () {
return {
name: (process.server ? 'server' : 'client')
}

View File

@ -13,7 +13,7 @@
<script>
export default {
asyncData({ req }) {
asyncData ({ req }) {
return {
name: req ? 'server' : 'client'
}

View File

@ -3,7 +3,7 @@ import { Line } from 'vue-chartjs'
export default {
extends: Line,
props: ['data', 'options'],
mounted() {
mounted () {
this.renderChart(this.data, this.options)
}
}

View File

@ -83,7 +83,7 @@
<script>
export default {
data() {
data () {
return {
clipped: false,
drawer: true,

View File

@ -21,7 +21,7 @@ storiesOf('Features/Method for rendering Vue', module)
render: h => h('div', ['renders a div with some text in it..'])
}))
.add('render + component', () => ({
render(h) {
render (h) {
return h(MyButton, { props: { color: 'pink' } }, ['renders component: MyButton'])
}
}))
@ -49,7 +49,7 @@ storiesOf('Features/Method for rendering Vue', module)
}))
.add('JSX', () => ({
components: { MyButton },
render() {
render () {
return <my-button>MyButton rendered with JSX</my-button>
}
}))
@ -59,14 +59,14 @@ storiesOf('Features/Method for rendering Vue', module)
store: new Vuex.Store({
state: { count: 0 },
mutations: {
increment(state) {
increment (state) {
state.count += 1; // eslint-disable-line
action('vuex state')(state)
}
}
}),
methods: {
log() {
log () {
this.$store.commit('increment')
}
}
@ -78,14 +78,14 @@ storiesOf('Features/Method for rendering Vue', module)
store: new Vuex.Store({
state: { count: 0 },
mutations: {
increment(state) {
increment (state) {
state.count += 1; // eslint-disable-line
action('vuex state')(state)
}
}
}),
methods: {
log() {
log () {
this.$store.commit('increment')
}
}
@ -108,7 +108,7 @@ storiesOf('Features/Decorator for Vue', module)
return {
components: { WrapButton },
template: '<div :style="{ border: borderStyle }"><wrap-button/></div>',
data() {
data () {
return { borderStyle: 'medium solid red' }
}
}
@ -116,7 +116,7 @@ storiesOf('Features/Decorator for Vue', module)
.addDecorator(() => ({
// Decorated with `story` component
template: '<div :style="{ border: borderStyle }"><story/></div>',
data() {
data () {
return {
borderStyle: 'medium solid blue'
}
@ -126,7 +126,7 @@ storiesOf('Features/Decorator for Vue', module)
template: '<my-button>MyButton with template</my-button>'
}))
.add('render', () => ({
render(h) {
render (h) {
return h(MyButton, { props: { color: 'pink' } }, ['renders component: MyButton'])
}
}))

View File

@ -88,7 +88,7 @@ const menuItemsAlt = [
storiesOf('Vuetify/V-Btn', module)
.add('Square Button', () => ({
components: {},
data() {
data () {
return {
items: menuItems
}
@ -98,7 +98,7 @@ storiesOf('Vuetify/V-Btn', module)
}))
.add('with rounded button', () => ({
components: {},
data() {
data () {
return {
items: menuItemsAlt
}

View File

@ -26,7 +26,7 @@ export default {
}
}
`,
data() {
data () {
return {
fontSize: 60
}

View File

@ -4,7 +4,7 @@ const purgecss = require('@fullhuman/postcss-purgecss')
const tailwindConfig = path.join(__dirname, 'tailwind.js')
class TailwindExtractor {
static extract(content) {
static extract (content) {
return content.match(/[A-Za-z0-9-_:\/]+/g) || [] // eslint-disable-line no-useless-escape
}
}

View File

@ -142,7 +142,7 @@ module.exports = {
|
*/
colors: colors,
colors,
/*
|-----------------------------------------------------------------------------

View File

@ -142,7 +142,7 @@ export default {
|
*/
colors: colors,
colors,
/*
|-----------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@
<script>
export default {
asyncData({ req }) {
asyncData ({ req }) {
return {
name: req ? 'server' : 'client'
}

View File

@ -19,13 +19,13 @@ export default {
Car: {
query: car,
prefetch: ({ route }) => ({ id: route.params.id }),
variables() {
variables () {
return { id: this.$route.params.id }
}
}
},
methods: {
formatCurrency(num) {
formatCurrency (num) {
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
@ -34,7 +34,7 @@ export default {
return formatter.format(num)
}
},
head() {
head () {
return {
title: (this.Car ? `${this.Car.make} ${this.Car.model}` : 'Loading')
}

View File

@ -3,7 +3,7 @@ import { Bar } from 'vue-chartjs'
export default {
extends: Bar,
props: ['data', 'options'],
mounted() {
mounted () {
this.renderChart(this.data, this.options)
}
}

View File

@ -3,7 +3,7 @@ import { Doughnut } from 'vue-chartjs'
export default {
extends: Doughnut,
props: ['data', 'options'],
mounted() {
mounted () {
this.renderChart(this.data, this.options)
}
}

View File

@ -8,7 +8,7 @@
import axios from 'axios'
import DoughnutChart from '~/components/doughnut-chart'
function getRandomColor() {
function getRandomColor () {
const letters = '0123456789ABCDEF'
let color = '#'
for (let i = 0; i < 6; i++) {
@ -21,7 +21,7 @@ export default {
components: {
DoughnutChart
},
async asyncData({ env }) {
async asyncData ({ env }) {
const res = await axios.get(`https://api.github.com/repos/nuxt/nuxt.js/stats/contributors?access_token=${env.githubToken}`)
return {
doughnutChartData: {

View File

@ -13,7 +13,7 @@ export default {
components: {
BarChart
},
async asyncData({ env }) {
async asyncData ({ env }) {
const res = await axios.get(`https://api.github.com/repos/nuxt/nuxt.js/stats/commit_activity?access_token=${env.githubToken}`)
return {
barChartData: {

View File

@ -30,17 +30,17 @@ class Base extends Vue {
msg = 123
// lifecycle hook
mounted() {
mounted () {
this.greet()
}
// computed
get computedMsg() {
get computedMsg () {
return 'computed ' + this.msg
}
// method
greet() {
greet () {
console.log('base greeting: ' + this.msg) // eslint-disable-line no-console
}
}

View File

@ -23,7 +23,7 @@ export default
@Component
class Child extends Base {
// override parent method
greet() {
greet () {
console.log('child greeting: ' + this.msg) // eslint-disable-line no-console
}
}

View File

@ -12,7 +12,7 @@ export default
components: { Child }
})
class App extends Vue {
asyncData({ req }) {
asyncData ({ req }) {
return { env: req ? 'server' : 'client' }
}
}

View File

@ -32,11 +32,11 @@ export default {
]),
// fetch(context) is called by the server-side
// and before instantiating the component
fetch({ store }) {
fetch ({ store }) {
store.commit('increment')
},
methods: {
increment() {
increment () {
this.$store.commit('increment')
}
}

View File

@ -24,7 +24,7 @@ export default {
todos: 'todos/todos'
}),
methods: {
addTodo(e) {
addTodo (e) {
const text = e.target.value
if (text.trim()) {
this.$store.commit('todos/add', { text })

View File

@ -7,13 +7,13 @@ export const state = () => ({
})
export const mutations = {
add(state, title) {
add (state, title) {
state.list.push(title)
}
}
export const getters = {
get(state) {
get (state) {
return state.list
}
}

View File

@ -7,7 +7,7 @@ export const state = () => ({
})
export const getters = {
get(state) {
get (state) {
return state.list
}
}

Some files were not shown because too many files have changed in this diff Show More