Comments (8)
Anytime.
Don't forget to star this repo ya 😂
from vue2-simplert.
You can use hook onClose
or onConfirm
and show second alert
from vue2-simplert.
You can change this to local variable so they can have wrong refer this
, like this example :
methods: {
deleteBtn () {
let self = this
let confirmFn = function () {
let obj2 = {
title: 'Success',
message: 'Staff record successfully deleted!',
type: 'success'
}
self.$refs.simplert.openSimplert(obj2)
}
let obj = {
title: 'Warning',
message: 'Are you sure you want to delete staff record?',
type: 'warning',
useConfirmBtn: true,
onConfirm: confirmFn
}
self.$refs.simplert.openSimplert(obj)
}
}
from vue2-simplert.
Hi! I've done what you said about using
let self = this
and it works perfectly fine now.
Thank you for your help! 👍
from vue2-simplert.
Hi again!
I got another problem which i don't quite understand...
I have an error which says, "Cannot read property '$refs' of undefined".
Is this due to the conflicting this.$refs.image.files for the top part of the code?
Here is my Vue Code:
submitStaff () {
if (this.$refs.image.files[0]) {
let formData = new FormData()
formData.append('userImage', this.$refs.image.files[0])
formData.append('name', this.data.name)
formData.append('username', this.data.username)
formData.append('password', this.data.password)
axios.post('/testing', formData)
.then(function (response) {
let self = this
let successAlert = {
title: 'Success',
message: 'Staff record successfully created!',
type: 'success'
}
self.$refs.simplert.openSimplert(successAlert)
})
.catch(function (error) {
console.log(error)
})
}
}
How do I go about fixing this problem?
Thank you for your help once again! (I starred this repo already 👍 )
from vue2-simplert.
You can move
let self = this
To the bottom of exactly code
submitStaff () {
I think you need learn about this
in Javascript, because this is standard of Javascript.
Not about this library. 😂
from vue2-simplert.
I feel so silly now! Haha sorry, i'm new to javascript and vue :-) learning and doing a project at the same time. Thanks for your help! 👍
from vue2-simplert.
No problem 👍
from vue2-simplert.
Related Issues (20)
- Add hook onShow HOT 1
- Compile .vue simplert to js library HOT 2
- Can I use vue2-simplert with `<script>`? HOT 5
- 请问如何当做插件全局注册,每次需要弹窗了就引用用下插件吧,这个很不友好 HOT 4
- Cover entire SPA with Simplert modal HOT 1
- Position the alert HOT 1
- use scoped styles instead of global HOT 5
- Open development Vue2-Simplert as Plugins
- ERROR can't load Simplert.vue HOT 8
- Failed to mount component: template or render function not defined. HOT 10
- Add contribution guide HOT 1
- Overlay background scroll should be disable when alert is active HOT 2
- Webpack build error HOT 6
- SSR HOT 4
- How to close on enter?
- Unit test failed
- Close button custom title HOT 4
- ButtonText slot?
- How to use Simplert with CDN HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue2-simplert.