Status management of the page

the vue page currently being written has the following different states, and my way of writing it is as follows

  data: function () {
        return {
            state: 1,  // 1: 2: 3: 4: 5
            deliveryState: 1,    //:1: 2:
        }
    },

write

if you change the state.

this.state=2

I don"t think it"s good to write the page state like this
1. If you don"t know the state code when assigning the state, you don"t know how to assign it
2. If you want to use more than one page, you have to write it in data. If you write the status separately in the js file, is there any good way to write it? is there any good way to write it? code scum, please teach

.
Just write

as an enumeration, define an enumeration file yourself, and then import come in.


  1. directly assigns a string, it's all js, and it's written as stingy in memory as c, and use English if you're afraid of something wrong with Chinese.
  2. // data.js
    export default function() {
        return { ...whatever }
    }
    
    // page.js
    import data from './data.js'
    const Component = Vue.extend({ data })
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9ed41-477d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9ed41-477d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?