Vue.js

ESLint & Vue - How to ban the use of `$log`?

依然范特西╮ 提交于 2021-02-07 20:43:30
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

ESLint & Vue - How to ban the use of `$log`?

微笑、不失礼 提交于 2021-02-07 20:41:01
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

ESLint & Vue - How to ban the use of `$log`?

≡放荡痞女 提交于 2021-02-07 20:40:49
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

NNS域名系统之SGAS

五迷三道 提交于 2021-02-07 20:34:16
0x00 前言 基于NEO进行dapp开发的过程中,基于UTXO的GAS并不方便作为dapp的代币使用,于是为了便于在DAPP中直接接入GAS,NEL颜值和技术担当李总开发了基于NEP5的SGAS合约,用于与GAS进行一比一兑换,搭建了应用合约与UTXO之间的桥梁。 尽管SGAS开发的初衷是为了NNS域名竞拍系统的功能实现,但是李总在设计的时候便将SGAS定义为一种通用的NEP5合约,因此任何需要在DAPP中使用GAS作为燃料的合约都可以直接使用SGAS。 0x01 获取SGAS SGAS是NEP5的代币合约,本身并没有发行量,只有当用户向SGAS合约地址转入GAS时,SGAS合约才会发行对应数量的SGAS代币,并把新发行的SGAS转给该用户。 接下来的内容设计应用合约脚本的构建,建议阅读之前先了解下这方面的知识。 前文已经提到获取SGAS需要用户向SGAS合约地址充值指定金额的GAS,但是仅仅转账是没有办法实现SGAS发行的,因为GAS转账的过程是鉴权合约调用的过程,这个过程中SGAS合约无法进行数据的写入,而SGAS发行代币的方式就是通过数据的记录,这也就意味着SGAS没有办法进行发行操作。为了解决这个问题,在转账之后,还需要通过应用合约的调用过程来向用户地址解锁指定数量的SGAS,完成GAS兑换SGAS的过程。 var sb = new ThinNeo

Cannot access element shown by v-if in component mounted callback

▼魔方 西西 提交于 2021-02-07 19:59:22
问题 <template> <div> <transition name="fade" mode="out-in"> <div class="ui active inline loader" v-if="loading" key="loading"></div> <div v-else key="loaded"> <span class="foo" ref="foo">the content I'm after is here</span> </div> </transition> </div> </template> <script> export default { data() { return { loaded: false } }, mounted() { setTimeout(() => { // simulate async operation this.loaded = true console.log($(this.$refs.foo).length, $(this.$el.find('.foo')).length) }, 2000) }, } </script>

Cannot access element shown by v-if in component mounted callback

淺唱寂寞╮ 提交于 2021-02-07 19:58:22
问题 <template> <div> <transition name="fade" mode="out-in"> <div class="ui active inline loader" v-if="loading" key="loading"></div> <div v-else key="loaded"> <span class="foo" ref="foo">the content I'm after is here</span> </div> </transition> </div> </template> <script> export default { data() { return { loaded: false } }, mounted() { setTimeout(() => { // simulate async operation this.loaded = true console.log($(this.$refs.foo).length, $(this.$el.find('.foo')).length) }, 2000) }, } </script>

Vuex computed properties only work with getters

杀马特。学长 韩版系。学妹 提交于 2021-02-07 19:25:32
问题 When I put this in my Vue component ... // using store getter computed: { authenticated() { return this.$store.getters.authenticated } } ... it works. The value for authenticated is reactive and the computed property returns true when the value in the vuex store is true . This should work ... (and would be the right way according to the docs) // using store state computed: { authenticated() { return this.$store.state.authenticated } } ... but doesn't. The computed property is always false .

Vuex computed properties only work with getters

痴心易碎 提交于 2021-02-07 19:24:58
问题 When I put this in my Vue component ... // using store getter computed: { authenticated() { return this.$store.getters.authenticated } } ... it works. The value for authenticated is reactive and the computed property returns true when the value in the vuex store is true . This should work ... (and would be the right way according to the docs) // using store state computed: { authenticated() { return this.$store.state.authenticated } } ... but doesn't. The computed property is always false .

missing attribute on result, Vue, Apollo and GraphQL

折月煮酒 提交于 2021-02-07 19:18:30
问题 Im totally new to developing with Apollo & GraphQL in Vue applications, and have been stuck on a small problem for some time now. I keep getting the error: Missing clients attribute on result I can see that the request returns data in the Network tab, so it seems to be something else than the query, when it's failing, but cant quite figure out what it is. Currently im doing this query: MyQuery.js import gql from 'graphql-tag'; export const allClientsQuery = gql` query clients { client: client

missing attribute on result, Vue, Apollo and GraphQL

佐手、 提交于 2021-02-07 19:18:19
问题 Im totally new to developing with Apollo & GraphQL in Vue applications, and have been stuck on a small problem for some time now. I keep getting the error: Missing clients attribute on result I can see that the request returns data in the Network tab, so it seems to be something else than the query, when it's failing, but cant quite figure out what it is. Currently im doing this query: MyQuery.js import gql from 'graphql-tag'; export const allClientsQuery = gql` query clients { client: client