[ad_1]
我有两个组件,TimeLine.vue(Parent) 和 SuspishedMemo.vue(Child)
TimeLine.vue(父级)
computed: { optionsData () { groupTemplate: (item, element, data) => { if (!item) return var container = document.createElement('div') if (item.isDisable !== true) container.setAttribute('class', 'enable') var i = document.createElement('i') // click i.addEventListener('click', () => { // itemのidを取得してSuspendedMemoに渡す var itemId = item.id const url = `/shop/${this.selectedShopId}/room/${itemId}/suspend_memo` console.log('Timeline of URL’, url) this.data = item.suspendedReserveMemo this.openMemo() }) i.setAttribute('class', 'v-icon notranslate mr-2 mdi mdi-close-circle theme--light pink--text') container.appendChild(i) var span = document.createElement('span') span.innerHTML = item.content container.appendChild(span) return container } } return _.merge({}, base, this.options) } },
当我点击 ↑ 时,如何将变量 ‘url’ 发送到 SuspishedMemo.vue(Child) 组件?
我尝试过的:
How to send variable from Parent to Child component when I use "click" at Vue.js?
解决方案1
[ad_2]
コメント