The problem follows the vue import export.

there are now three files
data.js

import {calNum} from". / Cal" export const a = {name:calNum}

Cal.vue

< script >

const calNum=0

export default {

calNum }

< / script >

test.vue

< template >

<div style="margin-top: 100px">
    <button @click="clickBtn">test</button>
</div> </template>

< script >

import {a} from "./data"
import cal from "./Cal"

export default {

name: "test",
methods:{
  clickBtn(){
    cal.calNumPP
    console.log(cal.calNum)
    console.log(a.name)
  }
}   } </script>

< style scoped >

< / style >

I saved a value in cal and referenced it in data. I set a button in the test interface. Every time I click on the value in cal, the value + 1.
now the test finds out why the value in the output cal can be added by one every time I click, but the value in data is always the initial value.

clipboard.png


that is an assignment. Name is assigned to 0 when it is initialized. What is visited later is that name=0,name=cal.calNum represents the value of name equals calNum, which is not equal to calNum,. Only when name equals an object will it be associated. A common value will not be associated

.
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-1e9196f-136a.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-1e9196f-136a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?